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:
darrenr 2004-07-11 16:07:07 +00:00
parent a6214e1123
commit 210d568a00

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