Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/rwlock.h
Show First 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | |||||
* the work is deferred to another function. | * the work is deferred to another function. | ||||
*/ | */ | ||||
/* Acquire a write lock. */ | /* Acquire a write lock. */ | ||||
#define __rw_wlock(rw, tid, file, line) do { \ | #define __rw_wlock(rw, tid, file, line) do { \ | ||||
uintptr_t _tid = (uintptr_t)(tid); \ | uintptr_t _tid = (uintptr_t)(tid); \ | ||||
uintptr_t _v = RW_UNLOCKED; \ | uintptr_t _v = RW_UNLOCKED; \ | ||||
\ | \ | ||||
if (__predict_false(LOCKSTAT_PROFILE_ENABLED(rw__acquire) || \ | if (__predict_false_noprobe(LOCKSTAT_PROFILE_ENABLED(rw__acquire) || \ | ||||
!_rw_write_lock_fetch((rw), &_v, _tid))) \ | !_rw_write_lock_fetch((rw), &_v, _tid))) \ | ||||
_rw_wlock_hard((rw), _v, (file), (line)); \ | _rw_wlock_hard((rw), _v, (file), (line)); \ | ||||
} while (0) | } while (0) | ||||
/* Release a write lock. */ | /* Release a write lock. */ | ||||
#define __rw_wunlock(rw, tid, file, line) do { \ | #define __rw_wunlock(rw, tid, file, line) do { \ | ||||
uintptr_t _v = (uintptr_t)(tid); \ | uintptr_t _v = (uintptr_t)(tid); \ | ||||
\ | \ | ||||
if (__predict_false(LOCKSTAT_PROFILE_ENABLED(rw__release) || \ | if (__predict_false_noprobe(LOCKSTAT_PROFILE_ENABLED(rw__release) || \ | ||||
!_rw_write_unlock_fetch((rw), &_v))) \ | !_rw_write_unlock_fetch((rw), &_v))) \ | ||||
_rw_wunlock_hard((rw), _v, (file), (line)); \ | _rw_wunlock_hard((rw), _v, (file), (line)); \ | ||||
} while (0) | } while (0) | ||||
/* | /* | ||||
* Function prototypes. Routines that start with _ are not part of the | * Function prototypes. Routines that start with _ are not part of the | ||||
* external API and should not be called directly. Wrapper macros should | * external API and should not be called directly. Wrapper macros should | ||||
* be used instead. | * be used instead. | ||||
▲ Show 20 Lines • Show All 171 Lines • Show Last 20 Lines |