Expand description
BlockingRWLock: cross-process reader-writer lock with a
kernel-park slow path via CrossProcessWaker.
Composes crate::shared_rw_lock::SharedRWLock
with one CrossProcessWaker plus a small mmap-backed
wakeup-generation counter. The hot path delegates to
try_read_lock / try_write_lock (single CAS each). The
contention slow path differs from the existing primitive:
SharedRWLock::read_lock/write_lockspin → yield →sleep(50us)indefinitely until the lock becomes available. The sleep tail burns CPU on each wake-up tick AND can miss an unlock by up to 50us.BlockingRWLock::read_park/write_parkregister in the waker at the current generation, then park in the kernel. The kernel returns within microseconds of the next unlock.
Both readers and writers park on the SAME waker; an unlock
fires wake_all so the contending side picks up the lock
according to the underlying writer-priority policy.
Structs§
- BlockingRW
Lock - Cross-process reader-writer lock with kernel-park slow path.
- Blocking
Read Guard - RAII guard for a held read-lock. Drops to release.
- Blocking
Write Guard - RAII guard for a held write-lock. Drops to release.
Enums§
- BlockingRW
Lock Error - Errors returned by
BlockingRWLockoperations.