Mutual exclusion primitive (a lock).
If you want to guard shared state, use Mutex α instead.
Equations
Instances For
Creates a new BaseMutex.
Locks a BaseMutex. Waits until no other thread has locked the mutex.
The current thread must not have already locked the mutex. Reentrant locking is undefined behavior (inherited from the C++ implementation).
Unlocks a BaseMutex.
The current thread must have already locked the mutex. Unlocking an unlocked mutex is undefined behavior (inherited from the C++ implementation).
Condition variable.
Equations
Instances For
Creates a new condition variable.
Waits on the condition variable until the predicate is true.
Equations
Instances For
Mutual exclusion primitive (lock) guarding shared state of type α.
The type Mutex α is similar to IO.Ref α,
except that concurrent accesses are guarded by a mutex
instead of atomic pointer operations and busy-waiting.
Instances For
Creates a new mutex.
Equations
Instances For
mutex.atomically k runs k with access to the mutex's state while locking the mutex.
Equations
Instances For
mutex.atomicallyOnce condvar pred k runs k,
waiting on condvar until pred returns true.
Both k and pred have access to the mutex's state.