diff options
author | davidxu <davidxu@FreeBSD.org> | 2006-01-09 07:32:22 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2006-01-09 07:32:22 +0000 |
commit | 8798f9bcecccc07ddc0f2f3474eb452dc309bf7a (patch) | |
tree | bebd2edb2f9829d1c60fb846f2e6d1223da1adcb /lib | |
parent | c2b2965b6a50e898bcf71ca5c930dbc79366049d (diff) | |
download | FreeBSD-src-8798f9bcecccc07ddc0f2f3474eb452dc309bf7a.zip FreeBSD-src-8798f9bcecccc07ddc0f2f3474eb452dc309bf7a.tar.gz |
Tweak macro THR_LOCK_RELEASE a bit for non-PTHREAD_INVARIANTS case.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libthr/thread/thr_private.h | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/libthr/thread/thr_private.h b/lib/libthr/thread/thr_private.h index 6725a43..653ae31 100644 --- a/lib/libthr/thread/thr_private.h +++ b/lib/libthr/thread/thr_private.h @@ -522,15 +522,22 @@ do { \ _thr_umtx_lock(lck, (thrd)->tid); \ } while (0) -#define THR_LOCK_RELEASE(thrd, lck) \ +#ifdef _PTHREADS_INVARIANTS +#define THR_ASSERT_LOCKLEVEL(thrd) \ do { \ - if ((thrd)->locklevel > 0) { \ - _thr_umtx_unlock((lck), (thrd)->tid); \ - (thrd)->locklevel--; \ - _thr_ast(thrd); \ - } else { \ + if (__predict_false((thrd)->locklevel <= 0)) \ _thr_assert_lock_level(); \ - } \ +} while (0) +#else +#define THR_ASSERT_LOCKLEVEL(thrd) +#endif + +#define THR_LOCK_RELEASE(thrd, lck) \ +do { \ + THR_ASSERT_LOCKLEVEL(thrd); \ + _thr_umtx_unlock((lck), (thrd)->tid); \ + (thrd)->locklevel--; \ + _thr_ast(thrd); \ } while (0) #define THR_LOCK(curthrd) THR_LOCK_ACQUIRE(curthrd, &(curthrd)->lock) |