diff options
author | mtm <mtm@FreeBSD.org> | 2003-05-21 03:29:18 +0000 |
---|---|---|
committer | mtm <mtm@FreeBSD.org> | 2003-05-21 03:29:18 +0000 |
commit | ef39a958df33c49c40cafca876e2aaf4611a8639 (patch) | |
tree | 75f65ff133c18ec9f518558a82ace78112b35318 /lib/libthr/thread/thr_exit.c | |
parent | 63229f0299c684df704d8675ce60db82dccf7e00 (diff) | |
download | FreeBSD-src-ef39a958df33c49c40cafca876e2aaf4611a8639.zip FreeBSD-src-ef39a958df33c49c40cafca876e2aaf4611a8639.tar.gz |
When a thread exits it does not return from the kernel unless it
is the *only* remaining thread in the application, in which case we
should not core dump, and instead exit gracefully.
Approved by: markm/mentor, re/blanket libthr
Diffstat (limited to 'lib/libthr/thread/thr_exit.c')
-rw-r--r-- | lib/libthr/thread/thr_exit.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libthr/thread/thr_exit.c b/lib/libthr/thread/thr_exit.c index f18c7c8..059af3d 100644 --- a/lib/libthr/thread/thr_exit.c +++ b/lib/libthr/thread/thr_exit.c @@ -171,6 +171,10 @@ _pthread_exit(void *status) PTHREAD_SET_STATE(curthread, PS_DEAD); GIANT_UNLOCK(curthread); + /* If we're the last thread, call it quits */ + if (TAILQ_EMPTY(&_thread_list)) + exit(curthread->ret); + /* * Retire the architecture specific id so that it can be used for * new threads. |