summaryrefslogtreecommitdiffstats
path: root/lib/libthr
diff options
context:
space:
mode:
authormtm <mtm@FreeBSD.org>2003-05-21 03:29:18 +0000
committermtm <mtm@FreeBSD.org>2003-05-21 03:29:18 +0000
commitef39a958df33c49c40cafca876e2aaf4611a8639 (patch)
tree75f65ff133c18ec9f518558a82ace78112b35318 /lib/libthr
parent63229f0299c684df704d8675ce60db82dccf7e00 (diff)
downloadFreeBSD-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')
-rw-r--r--lib/libthr/thread/thr_exit.c4
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.
OpenPOWER on IntegriCloud