1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-30 16:51:41 +00:00

Add sx_unlock() macro as a frontend to both sx_sunlock() and sx_xunlock(),

using sx_cnt to determine what state the lock is in and call the respective
function appropriately.
This commit is contained in:
Darren Reed 2004-07-11 16:07:07 +00:00
parent fa5afa1df0
commit 99e89d6725
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=131984

View File

@ -82,6 +82,13 @@ struct sx_args {
#define sx_xunlock(sx) _sx_xunlock((sx), LOCK_FILE, LOCK_LINE)
#define sx_try_upgrade(sx) _sx_try_upgrade((sx), LOCK_FILE, LOCK_LINE)
#define sx_downgrade(sx) _sx_downgrade((sx), LOCK_FILE, LOCK_LINE)
#define sx_unlock(sx) \
do { \
if ((sx)->sx_cnt < 0) \
sx_xunlock(sx); \
else \
sx_sunlock(sx); \
} while (0)
#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
#define SX_LOCKED LA_LOCKED