/
View dependency graph
Depends on
- debhelper (debhelper)
- dh-cargo (dh-cargo)
- rust-libc (librust-libc-0.2+default-dev)
- rust-once-cell (librust-once-cell-1+default-dev)
- cargo, librust-parking-lot-0.12+default-dev, librust-thiserror-1+default-dev, libstd-rust-dev, rustc
README (full)
named-lock
This crate provides a simple and cross-platform implementation of named locks. You can use this to lock sections between processes.
Example
use named_lock::NamedLock;
use named_lock::Result;
fn main() -> Result<()> {
let lock = NamedLock::create("foobar")?;
let _guard = lock.lock()?;
// Do something...
Ok(())
}
Implementation
On UNIX this is implemented by using files and flock. The path of the
created lock file will be $TMPDIR/<name>.lock, or /tmp/<name>.lock if
TMPDIR environment variable is not set.
On Windows this is implemented by creating named mutex with CreateMutexW.
| dir | .github/ |
| dir | debian/ |
| dir | src/ |
| file | .cargo_vcs_info.json |
| file | .gitignore |
| file | CHANGELOG.md |
| file | Cargo.toml |
| file | Cargo.toml.orig |
| file | LICENSE |
| file | README.md |
| file | rustfmt.toml |