4 releases

0.1.3 Jun 5, 2024
0.1.2 Apr 2, 2024
0.1.1 Mar 4, 2024
0.1.0 Feb 5, 2024

#187 in Filesystem

Download history 220/week @ 2024-04-04 90/week @ 2024-04-11 23/week @ 2024-04-18 82/week @ 2024-04-25 47/week @ 2024-05-02 37/week @ 2024-05-09 99/week @ 2024-05-16 759/week @ 2024-05-23 529/week @ 2024-05-30 177/week @ 2024-06-06 1007/week @ 2024-06-13 1025/week @ 2024-06-20 1167/week @ 2024-06-27 304/week @ 2024-07-04 120/week @ 2024-07-11 591/week @ 2024-07-18

2,218 downloads per month
Used in 16 crates (via tor-persist)

MIT/Apache

17KB
156 lines

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.

lib.rs:

Dependencies

~0.3–1MB
~19K SLoC