diff options
author | davidxu <davidxu@FreeBSD.org> | 2006-12-12 03:08:49 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2006-12-12 03:08:49 +0000 |
commit | fcda4340a4ca0dc2c34e3a1408e25a156a6bcd9e (patch) | |
tree | c2212f261bb0a72bc508e079a5b950a83c8f8989 /lib/libthr/thread/thr_umtx.c | |
parent | 114b7df825529c758df31aa3a412dc9d38456faf (diff) | |
download | FreeBSD-src-fcda4340a4ca0dc2c34e3a1408e25a156a6bcd9e.zip FreeBSD-src-fcda4340a4ca0dc2c34e3a1408e25a156a6bcd9e.tar.gz |
Move checking for c_has_waiters into low level _thr_ucond_signal and
_thr_ucond_broadcast, clear condition variable pointer in cancellation
info after returing from _thr_ucond_wait, since kernel has already
dropped the internal lock, so we don't need to unlock it in cancellation
handler again.
Diffstat (limited to 'lib/libthr/thread/thr_umtx.c')
-rw-r--r-- | lib/libthr/thread/thr_umtx.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libthr/thread/thr_umtx.c b/lib/libthr/thread/thr_umtx.c index 8a8c908..9de346e 100644 --- a/lib/libthr/thread/thr_umtx.c +++ b/lib/libthr/thread/thr_umtx.c @@ -131,6 +131,8 @@ _thr_ucond_wait(struct ucond *cv, struct umutex *m, int _thr_ucond_signal(struct ucond *cv) { + if (!cv->c_has_waiters) + return (0); if (_umtx_op(cv, UMTX_OP_CV_SIGNAL, 0, NULL, NULL) == 0) return (0); return (errno); @@ -139,6 +141,8 @@ _thr_ucond_signal(struct ucond *cv) int _thr_ucond_broadcast(struct ucond *cv) { + if (!cv->c_has_waiters) + return (0); if (_umtx_op(cv, UMTX_OP_CV_BROADCAST, 0, NULL, NULL) == 0) return (0); return (errno); |