From 9dbfb036ab5c3c3ecedf1ba5ad7e5904492b6f49 Mon Sep 17 00:00:00 2001 From: davidxu Date: Tue, 18 Mar 2008 02:06:51 +0000 Subject: - Copy signal mask out before THR_UNLOCK(), because THR_UNLOCK() may call _thr_suspend_check() which messes sigmask saved in thread structure. - Don't suspend a thread has force_exit set. - In pthread_exit(), if there is a suspension flag set, wake up waiting- thread after setting PS_DEAD, this causes waiting-thread to break loop in suspend_common(). --- lib/libthr/thread/thr_exit.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/libthr/thread/thr_exit.c') diff --git a/lib/libthr/thread/thr_exit.c b/lib/libthr/thread/thr_exit.c index 7d902ca..c636693 100644 --- a/lib/libthr/thread/thr_exit.c +++ b/lib/libthr/thread/thr_exit.c @@ -121,6 +121,10 @@ _pthread_exit(void *status) } THR_LOCK(curthread); curthread->state = PS_DEAD; + if (curthread->flags & THR_FLAGS_NEED_SUSPEND) { + curthread->cycle++; + _thr_umtx_wake(&curthread->cycle, INT_MAX); + } THR_UNLOCK(curthread); /* * Thread was created with initial refcount 1, we drop the -- cgit v1.1