Single-threaded applications use this for deadlock checks in debug mode, and no-ops in release modes.
Fields
state: enum { unlocked, locked_exclusive, locked_shared, _, } = .unlocked,
shared_count: usize = 0,
Functions
fn tryLock(rwl: *SingleThreadedRwLock) bool
Attempts to obtain exclusive lock ownership. Returns
true
if the lock is obta…Attempts to obtain exclusive lock ownership. Returns
true
if the lock is obtained,false
otherwise.fn tryLockShared(rwl: *SingleThreadedRwLock) bool
Attempts to obtain shared lock ownership. Returns
true
if the lock is obtaine…Attempts to obtain shared lock ownership. Returns
true
if the lock is obtained,false
otherwise.fn unlock(rwl: *SingleThreadedRwLock) void
Releases a held exclusive lock. Asserts the lock is held exclusively.