fslock-guard

Crates.iofslock-guard
lib.rsfslock-guard
version0.2.0
sourcesrc
created_at2024-02-05 18:40:35.438691
updated_at2024-09-30 15:58:31.657538
descriptionWrapper around a lockfile with unlock-on-drop semantics
homepagehttps://gitlab.torproject.org/tpo/core/arti/-/wikis/home
repositoryhttps://gitlab.torproject.org/tpo/core/arti.git/
max_upload_size
id1127843
size16,380
David Goulet (dgoulet-tor)

documentation

README

fslock-guard — A guard object to ensure we have an exclusive lock to a file

This crate is a thin wrapper around fslock, which uses flock(2) or LockFileEx to acquire an advisory lock on the filesystem.

We add two features that fslock does not (currently) have:

  • We have a [LockFileGuard] type, 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.
Commit count: 0

cargo fmt