diff --git a/src/api/thread.c b/src/api/thread.c index fc90ce9..a81842e 100644 --- a/src/api/thread.c +++ b/src/api/thread.c @@ -309,7 +309,7 @@ int thread_create(struct task_ids *ids, unsigned int flags) return -ENOMEM; if (flags == THREAD_SAME_SPACE || flags == THREAD_COPY_SPACE) { - if (!(orig_task = tcb_find_by_space(ids->spid))) { + if (!(orig_task = tcb_find(ids->tid))) { /* Pre-mature tcb needs freeing by free_page */ free_page(new); return -EINVAL; diff --git a/tasks/mm0/src/task.c b/tasks/mm0/src/task.c index e069db0..02c6268 100644 --- a/tasks/mm0/src/task.c +++ b/tasks/mm0/src/task.c @@ -308,7 +308,7 @@ struct tcb *task_create(struct tcb *parent, struct task_ids *ids, /* Set task ids if a parent is supplied */ if (parent) { - ids->tid = TASK_ID_INVALID; + ids->tid = parent->tid; ids->spid = parent->spid; /*