Skip to main content

Module sync_guard

Module sync_guard 

Source
Expand description

Poison-safe lock accessors.

std::sync locks become poisoned when a thread panics while holding them; afterwards every lock() panics again, permanently breaking the subsystem for the rest of the process lifetime. These helpers recover the guard instead, so one stray panic cannot take down unrelated code.

Functionsยง

mutex_lock
Acquire a mutex guard, recovering from a poisoned lock.
read_lock
Acquire a read guard, recovering from a poisoned lock.
write_lock
Acquire a write guard, recovering from a poisoned lock.