diff --git a/C/threads.c b/C/threads.c index 49d476692..551c7fe79 100755 --- a/C/threads.c +++ b/C/threads.c @@ -365,12 +365,20 @@ Yap_thread_self(void) CELL Yap_thread_create_engine(thread_attr *ops) { + thread_attr opsv; Term t = TermNil; int new_id = allocate_new_tid(); if (new_id == -1) { /* YAP ERROR */ return FALSE; } + if (ops == NULL) { + ops = &opsv; + ops->tsize = DefHeapSpace; + ops->ssize = DefStackSpace; + ops->sysize = 0; + ops->egoal = t; + } if (!init_thread_engine(new_id, ops->ssize, ops->tsize, ops->sysize, &t, &t, &(ops->egoal))) return FALSE; FOREIGN_ThreadHandle(new_id).id = new_id;