Skip to main content

with_writer_lock

Function with_writer_lock 

Source
fn with_writer_lock<T>(
    lock: &Mutex<()>,
    wait: Duration,
    write: impl FnOnce() -> T,
) -> Result<T, String>
Expand description

Run write once lock is free, waiting at most wait for it. A dump that cannot get the lock in time is not written (Err): the caller carries on, and whoever holds it is writing a dump already. A lock a panicked writer left poisoned is taken all the same: it guards no data.