1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! ---
//! # PLEASE NOTE: THIS CRATE HAS BEEN RENAMED
//!
//! It used to be `proclock`, but it's been renamed to [proc-lock](https://crates.io/crates/proc-lock).
//!
//! Please update your dependencies to receive newer versions.
//!
//! ---
//!
//! A simple cross-process locking API.
//! # Implementation
//! This crate uses [`fs2`](https://docs.rs/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:
//! ```toml
//! [dependencies]
//! proclock = "*"
//! ```
//!
//! ### Using the API directly
//! ```rust
//! use proclock::{lock, LockPath};
//!
//! let lock_path = LockPath::Tmp("my_lock.lock");
//! let guard = lock(&lock_path).unwrap();
//! // Until `guard` is dropped, this code section is atomic across multiple processes.
//! // ...
//! drop(guard);
//! ```
//!
//! ### Using macros
//! ```rust
//! use proclock::proclock;
//!
//! fn main() {
//! // A lock will be acquired at the beginning of this function, and will be released at the end.
//! a_sensitive_function();
//! }
//!
//! #[proclock(name = "my_lock.lock")]
//! fn a_sensitive_function() {}
//! ```
pub use *;
pub use *;