A simple cross-process locking API.
Implementation
This crate uses fs2
to exclusively lock files, and provides a convenient API to
use this mechanism for synchronizing between multiple processes.
Quick Start
Installation
In your Cargo.toml
file, add:
[]
= "*"
Using the API directly
use ;
let lock_path = Tmp;
let guard = lock.unwrap;
// Until `guard` is dropped, this code section is atomic across multiple processes.
// ...
drop;
Using macros
use proc_lock;