From 19ffe8108d1aa7f17d517bfa7ea7357c98b38e98 Mon Sep 17 00:00:00 2001 From: davidxu Date: Tue, 11 Mar 2008 03:26:47 +0000 Subject: 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 6a0bfc1..ada158c 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 -- cgit v1.1