Skip to main content

hold_lock

Function hold_lock 

Source
pub async fn hold_lock(
    file: &Path,
    waiting: &mut (dyn FnMut() + Send),
) -> Result<FileLock, ChestError>
Expand description

Locks file as FileLock::acquire does, but waits for as long as another holder keeps the lock fresh, where acquire gives up after the stale period. A holder that stopped stops refreshing, so its lock goes stale and is taken over. waiting hears once that the lock is held, when it is not free within a second.