Skip to content
This repository has been archived by the owner on Oct 31, 2020. It is now read-only.

Commit

Permalink
don't use pthread_exit. switch to primorial thread and return normally
Browse files Browse the repository at this point in the history
  • Loading branch information
toffaletti committed Nov 30, 2011
1 parent 930a93c commit f0ebf18
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
4 changes: 1 addition & 3 deletions examples/threaded.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,5 @@ int main(int argc, char *argv[]) {
}

st_thread_exit(NULL);
printf("does not happen\n");

return 1;
return 0;
}
9 changes: 3 additions & 6 deletions sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,11 @@ void *_st_idle_thread_start(void *arg)
_ST_SWITCH_CONTEXT(me);
}

_ST_RESTORE_CONTEXT(_st_this_vp.primorial_thread);
/* No more threads */
free(_st_this_vp.primorial_thread);
/* Free resources in use by event system */
(*_st_eventsys->free)();

pthread_exit(NULL);

/* NOTREACHED */
return NULL;
}

Expand Down Expand Up @@ -288,10 +285,10 @@ void st_thread_exit(void *retval)
_st_stack_free(thread->stack);
}


/* Find another thread to run */
_ST_SWITCH_CONTEXT(thread);
/* Not going to land here */
free(thread);
(*_st_eventsys->free)();
}


Expand Down

0 comments on commit f0ebf18

Please sign in to comment.