Skip to main content

take_lock

Function take_lock 

Source
pub fn take_lock(path: &Path) -> Result<Option<PullLock>, PullError>
Expand description

Take an exclusive lock on path, creating it if it is not there, or None when someone else holds it. The lock lives with the returned handle.

A lock file may be unlinked by a sweep between this opening it and locking it; a lock on a file that is no longer at its path is a lock on nothing anyone else can see, so the path is opened again. After [LOCK_REOPENS] sweeps in a row it is given up on, which reads as held.