Skip to main content

Module locks

Module locks 

Source
Expand description

Taking a lock whose holder may have panicked.

A panic in a thread that holds a Mutex, or holds an RwLock for writing, poisons the lock: std’s way of saying the value may be half-changed. These helpers are for a lock whose every change is whole before anything in it can panic, so the caller uses the poisoned lock’s value as it is. A lock whose change can leave half-made state needs a different answer, which its owner chooses.

Functions§

into_unpoisoned
Return the value of mutex, which no panic can leave half-changed, and consume the mutex.
lock_unpoisoned
Lock mutex, whose value no panic can leave half-changed.
read_unpoisoned
Read lock, whose value no panic can leave half-changed.
wait_unpoisoned
Wait on condvar with guard, the guard of a lock whose value no panic can leave half-changed.
write_unpoisoned
Write lock, whose value no panic can leave half-changed.