Expand description
Advisory file locks that cannot wait forever.
std::fs::File::lock has no timed form. A caller blocked on a lock nobody
will release produces no error, no log line, and no stack — the process
simply stops, and whatever supervises it can report only that it stopped.
Recovering the reason means reproducing the wedge, and a rare interleaving
can cost days of runner time to hit twice.
Every acquisition here carries a deadline and names the path it waited on, so a wedge surfaces as an error that says which lock and for how long.
The deadline is a diagnostic bound, not a coordination mechanism. Callers pick one from how long the critical section legitimately runs — schema initialization is milliseconds, a package install can be minutes — and set it far enough above that ceiling that expiry means something is wrong rather than merely slow.
Enums§
Functions§
- lock_
with_ deadline - Take an advisory lock on
file, giving up aftertimeout.