diff options
author | davidxu <davidxu@FreeBSD.org> | 2003-08-18 04:03:08 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2003-08-18 04:03:08 +0000 |
commit | 49037ec1b200d71eb93decf5b78b2d3449224487 (patch) | |
tree | 4b8442f3dff515b91c7d5ed492e67205f33fa3ff /lib/libpthread | |
parent | 3203dde90e7e2cb93d8cfb8292002c02bd4a32d7 (diff) | |
download | FreeBSD-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/libpthread')
-rw-r--r-- | lib/libpthread/thread/thr_exit.c | 2 |
1 files changed, 2 insertions, 0 deletions
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]; |