From 49037ec1b200d71eb93decf5b78b2d3449224487 Mon Sep 17 00:00:00 2001 From: davidxu Date: Mon, 18 Aug 2003 04:03:08 +0000 Subject: 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 --- lib/libpthread/thread/thr_exit.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/libpthread/thread/thr_exit.c') 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]; -- cgit v1.1