Module std::sys::windows::locks::mutex

source ·
Expand description

System Mutexes

The Windows implementation of mutexes is a little odd and it might not be immediately obvious what’s going on. The primary oddness is that SRWLock is used instead of CriticalSection, and this is done because:

  1. SRWLock is several times faster than CriticalSection according to benchmarks performed on both Windows 8 and Windows 7.

  2. CriticalSection allows recursive locking while SRWLock deadlocks. The Unix implementation deadlocks so consistency is preferred. See #19962 for more details.

  3. While CriticalSection is fair and SRWLock is not, the current Rust policy is that there are no guarantees of fairness.

Structs

Functions