diff options
author | Mike Makonnen <mtm@FreeBSD.org> | 2004-10-06 14:23:00 +0000 |
---|---|---|
committer | Mike Makonnen <mtm@FreeBSD.org> | 2004-10-06 14:23:00 +0000 |
commit | 401901ac438e4329e90fa82fbb7c77d527988113 (patch) | |
tree | 3804089a0d0cecc531066dc2a0a074eddea8153b /lib | |
parent | 18d2addc23a15f394376b15d645d91ee9c614ccc (diff) | |
download | src-401901ac438e4329e90fa82fbb7c77d527988113.tar.gz src-401901ac438e4329e90fa82fbb7c77d527988113.zip |
Close a race between a thread exiting and the freeing of it's stack.
After some discussion the best option seems to be to signal the thread's
death from within the kernel. This requires that thr_exit() take an
argument.
Discussed with: davidxu, deischen, marcel
MFC after: 3 days
Notes
Notes:
svn path=/head/; revision=136192
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libthr/thread/thr_exit.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/libthr/thread/thr_exit.c b/lib/libthr/thread/thr_exit.c index f71c59a5dfb8..3ee5fa5b5424 100644 --- a/lib/libthr/thread/thr_exit.c +++ b/lib/libthr/thread/thr_exit.c @@ -43,7 +43,7 @@ __weak_reference(_pthread_exit, pthread_exit); /* thr_exit() */ -extern int _thr_exit(void); +extern int _thr_exit(long *state); static void deadlist_free_threads(); @@ -164,7 +164,6 @@ _pthread_exit(void *status) deadlist_free_threads(); TAILQ_INSERT_HEAD(&_dead_list, curthread, dle); TAILQ_REMOVE(&_thread_list, curthread, tle); - curthread->isdead = 1; /* If we're the last thread, call it quits */ if (TAILQ_EMPTY(&_thread_list)) @@ -181,7 +180,7 @@ _pthread_exit(void *status) * thread, which we can't be because we've already checked * for that. */ - _thr_exit(); + _thr_exit((long *)&curthread->isdead); /* This point should not be reached. */ PANIC("Dead thread has resumed"); |