The thread.started field is unnecessary for now.
The initial getcontext() call is unecessary as well. swapcontext() is
better for most instances where we are not creating a new thread.
Remove question mark ('?') from last statement.
void *arg;
ucontext_t context;
void *stack;
- int started;
int index;
};
t->start_routine = start_routine;
t->arg = arg;
- t->started = 0;
/* Initialize state */
getcontext(&t->context);
{
DBG();
- t->started = 1;
-
if (current) {
struct thread *old = current;
current = t;
{
struct thread t;
ucontext_t main_context;
- int pass = 0;
cleanup = &main_context;
thread_create(&t, &user_main, NULL);
- getcontext(&main_context);
- if (!pass++)
- thread_start(&t);
+ thread_start(&t);
DBG();
- DEBUG("Exiting?\n");
+ DEBUG("Exiting\n");
return 0;
}