summaryrefslogtreecommitdiffstats
path: root/lib/libthr
diff options
context:
space:
mode:
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