Skip to main content

acquire

Function acquire 

Source
pub fn acquire(issues_dir: &Path, session_id: &str) -> Result<AliveGuard>
Expand description

Try to acquire (and hold) an exclusive advisory lock for session_id.

The returned AliveGuard releases the lock when dropped — so callers must keep it alive for the whole session. Opening with write+create and calling flock(LOCK_EX | LOCK_NB) is atomic enough for our purposes: failure to acquire means another live process holds it.