Expand description
BlockingSemaphore: cross-process counting semaphore with a
kernel-park slow path via CrossProcessWaker.
Composes crate::shared_semaphore::SharedSemaphore
(the counter + generation-counter primitive) with one
CrossProcessWaker. The hot path is unchanged from
SharedSemaphore::try_acquire: a single CAS on the permit
count. The contention slow path differs:
SharedSemaphore::acquireloopstry_acquire→yield_now→sleep(50us)indefinitely. The sleep tail burns CPU on the wake-up tick AND can miss a release by up to 50us.BlockingSemaphore::acquire_parkloopstry_acquire, then registers in the waker at the current generation, then parks via the platform wait syscall. The kernel returns within microseconds of the nextrelease.
Cross-process Linux uses SHARED futex so a release from
process A wakes a parker in process B. Windows runs intra-
process via WaitOnAddress (one process at a time, share via
Arc::clone).
Structs§
- Blocking
Permit - RAII guard for an acquired permit. Drops to
release. - Blocking
Semaphore - Cross-process semaphore with a kernel-park slow path.
Enums§
- Blocking
Semaphore Error - Errors returned by
BlockingSemaphoreoperations.