mirror of
https://github.com/opnsense/src.git
synced 2026-04-22 06:39:32 -04:00
Tweak macro THR_LOCK_RELEASE a bit for non-PTHREAD_INVARIANTS case.
This commit is contained in:
parent
d5e61c97a6
commit
a53747d8fe
1 changed files with 14 additions and 7 deletions
|
|
@ -522,15 +522,22 @@ do { \
|
|||
_thr_umtx_lock(lck, (thrd)->tid); \
|
||||
} while (0)
|
||||
|
||||
#ifdef _PTHREADS_INVARIANTS
|
||||
#define THR_ASSERT_LOCKLEVEL(thrd) \
|
||||
do { \
|
||||
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 { \
|
||||
if ((thrd)->locklevel > 0) { \
|
||||
_thr_umtx_unlock((lck), (thrd)->tid); \
|
||||
(thrd)->locklevel--; \
|
||||
_thr_ast(thrd); \
|
||||
} else { \
|
||||
_thr_assert_lock_level(); \
|
||||
} \
|
||||
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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue