Expand description
§fslock-guard — A guard object to ensure we have an exclusive lock to a file
This crate is a thin wrapper around File::lock, which uses flock(2) or
LockFileEx to acquire an advisory lock on the filesystem.
We add two features that File::lock does not have:
- We have a
LockFileGuardtype, which can be used to ensure that a lock is actually held until the guard is dropped. - We perform a post-lock check to make sure that our lockfile has not been removed and re-created on disk by someone else. This check makes it safe to remove lockfiles.
Modules§
- os 🔒
- Platform module for locking protocol on Unix.
Structs§
- Lock
File Guard - A lock-file for which we hold the lock.
- Mismatched
Path 🔒Error - An error that we return when the path given to
delete_lock_filedoes not match the file we have.
Functions§
- do_lock 🔒
- Try to lock
f, blocking if need be. - do_
try_ 🔒lock - Try to lock
f, without blocking.