From ef39a958df33c49c40cafca876e2aaf4611a8639 Mon Sep 17 00:00:00 2001 From: mtm Date: Wed, 21 May 2003 03:29:18 +0000 Subject: 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 --- lib/libthr/thread/thr_exit.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/libthr') 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. -- cgit v1.1