From 150b71918c11ef3c90715b7bfee702c3c2f14b8a Mon Sep 17 00:00:00 2001 From: David Xu Date: Tue, 11 Mar 2008 03:26:47 +0000 Subject: [PATCH] If a thread is cancelled, it may have already consumed a umtx_wake, check waiter and semphore counter to see if we may wake up next thread. --- lib/libthr/thread/thr_sem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libthr/thread/thr_sem.c b/lib/libthr/thread/thr_sem.c index 6a0bfc12e77..ada158c1132 100644 --- a/lib/libthr/thread/thr_sem.c +++ b/lib/libthr/thread/thr_sem.c @@ -178,6 +178,8 @@ sem_cancel_handler(void *arg) sem_t *sem = arg; atomic_add_int(&(*sem)->nwaiters, -1); + if ((*sem)->nwaiters && (*sem)->count) + _thr_umtx_wake(&(*sem)->count, 1); } int