From 962eaaf9d641203f931e04e34f4bc5a1532bb099 Mon Sep 17 00:00:00 2001 From: David Xu Date: Mon, 18 Aug 2003 04:03:08 +0000 Subject: [PATCH] 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/libkse/thread/thr_exit.c | 2 ++ lib/libpthread/thread/thr_exit.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/libkse/thread/thr_exit.c b/lib/libkse/thread/thr_exit.c index 6dbef072a50..5894206a7c5 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 6dbef072a50..5894206a7c5 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];