summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2003-08-18 04:03:08 +0000
committerdavidxu <davidxu@FreeBSD.org>2003-08-18 04:03:08 +0000
commit49037ec1b200d71eb93decf5b78b2d3449224487 (patch)
tree4b8442f3dff515b91c7d5ed492e67205f33fa3ff /lib
parent3203dde90e7e2cb93d8cfb8292002c02bd4a32d7 (diff)
downloadFreeBSD-src-49037ec1b200d71eb93decf5b78b2d3449224487.zip
FreeBSD-src-49037ec1b200d71eb93decf5b78b2d3449224487.tar.gz
Direct call exit if thread was never created. This makes it safe to call
pthread_exit in main() without creating any thread. Tessted by: deischen
Diffstat (limited to 'lib')
-rw-r--r--lib/libkse/thread/thr_exit.c2
-rw-r--r--lib/libpthread/thread/thr_exit.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/libkse/thread/thr_exit.c b/lib/libkse/thread/thr_exit.c
index 6dbef07..5894206 100644
--- a/lib/libkse/thread/thr_exit.c
+++ b/lib/libkse/thread/thr_exit.c
@@ -87,6 +87,8 @@ _pthread_exit(void *status)
{
struct pthread *curthread = _get_curthread();
+ if (!_kse_isthreaded())
+ exit(0);
/* Check if this thread is already in the process of exiting: */
if ((curthread->flags & THR_FLAGS_EXITING) != 0) {
char msg[128];
diff --git a/lib/libpthread/thread/thr_exit.c b/lib/libpthread/thread/thr_exit.c
index 6dbef07..5894206 100644
--- a/lib/libpthread/thread/thr_exit.c
+++ b/lib/libpthread/thread/thr_exit.c
@@ -87,6 +87,8 @@ _pthread_exit(void *status)
{
struct pthread *curthread = _get_curthread();
+ if (!_kse_isthreaded())
+ exit(0);
/* Check if this thread is already in the process of exiting: */
if ((curthread->flags & THR_FLAGS_EXITING) != 0) {
char msg[128];
OpenPOWER on IntegriCloud