Skip to main content

Module lock

Module lock 

Source
Expand description

Advisory file locking for multi-process access to a links database.

Uses the standard library’s std::fs::File advisory locks (flock on Unix, LockFileEx on Windows). Locks are taken on a dedicated sidecar *.lock file rather than on the database itself, so that the lock survives operations that rewrite or remap the database file.

Advisory locks are held per open file description, which means two FileLock values inside a single process contend exactly the same way two separate processes do.

Structs§

FileLock
RAII guard around an advisory lock on a sidecar lock file.

Enums§

LockMode
Requested sharing mode for a FileLock.

Functions§

lock_file_path
Conventional sidecar lock filename for a links database.