Skip to main content

acquire_lock_async

Function acquire_lock_async 

Source
pub async fn acquire_lock_async(
    path: &Path,
    timeout: Duration,
) -> Result<LockGuard>
Expand description

Acquire an exclusive flock on path, blocking up to timeout. Returned guard releases the lock on drop.

The flock file is created if missing, but its content is unused — only the lock matters. Async wrapper around acquire_lock.

The blocking version parks the calling thread in a sleep loop for up to timeout. On a current-thread runtime — which is what the TUI uses — that stalls everything: keyboard input, the refresh timer, and every other vendor’s in-flight request. Running the wait on the blocking pool keeps the reactor free while a contended lock is waited on.