static void thread_dispose(struct thread *t)
{
DEBUG("completed thread %d\n", thread_current()->index);
- t->completed = 1;
+ t->state = THREAD_COMPLETED;
stack_free(t->stack);
}
if (ret)
return ret;
+ t->state = THREAD_CREATED;
+
model->scheduler->add_thread(t);
return 0;
}
void thread_join(struct thread *t)
{
- while (!t->completed)
+ while (t->state != THREAD_COMPLETED)
thread_yield();
}