summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2008-03-11 03:26:47 +0000
committerdavidxu <davidxu@FreeBSD.org>2008-03-11 03:26:47 +0000
commit19ffe8108d1aa7f17d517bfa7ea7357c98b38e98 (patch)
treedb380b694e3d2587fec5486d1764d30897ce9cbd
parent4b8e00a66eb686e4800c376842525c02e157c424 (diff)
downloadFreeBSD-src-19ffe8108d1aa7f17d517bfa7ea7357c98b38e98.zip
FreeBSD-src-19ffe8108d1aa7f17d517bfa7ea7357c98b38e98.tar.gz
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.
-rw-r--r--lib/libthr/thread/thr_sem.c2
1 files changed, 2 insertions, 0 deletions
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
OpenPOWER on IntegriCloud