Available on crate features
mutex
and ticket_mutex
only.Expand description
A ticket-based mutex.
Waiting threads take a ‘ticket’ from the lock in the order they arrive and gain access to the lock when their ticket is next in the queue. Best-case latency is slightly worse than a regular spinning mutex, but worse-case latency is infinitely better. Waiting threads simply need to wait for all threads that come before them in the queue to finish.
Structs§
- A spin-based ticket lock providing mutually exclusive access to data.
- A guard that protects some data.