diff options
author | davidxu <davidxu@FreeBSD.org> | 2008-03-11 03:26:47 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2008-03-11 03:26:47 +0000 |
commit | 19ffe8108d1aa7f17d517bfa7ea7357c98b38e98 (patch) | |
tree | db380b694e3d2587fec5486d1764d30897ce9cbd /lib/libthr/thread/thr_sem.c | |
parent | 4b8e00a66eb686e4800c376842525c02e157c424 (diff) | |
download | FreeBSD-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.
Diffstat (limited to 'lib/libthr/thread/thr_sem.c')
-rw-r--r-- | lib/libthr/thread/thr_sem.c | 2 |
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 |