proclock

Crates.ioproclock
lib.rsproclock
version0.2.2
sourcesrc
created_at2022-03-16 13:01:35.490292
updated_at2022-03-17 22:00:55.478316
descriptionA simple cross-process locking API
homepage
repositoryhttps://github.com/tabnine/proclock
max_upload_size
id551129
size3,665
(yonip23)

documentation

https://docs.rs/proclock

README

Developed with ❤️ by Tabnine


PLEASE NOTE: THIS CRATE HAS BEEN RENAMED

It used to be proclock, but it's been renamed to proc-lock.

Please update your dependencies to receive newer versions.


Proclock

A simple cross-process locking API.

Quick Start

Installation

In your Cargo.toml file, add:

[dependencies]
proclock = "*"

Using the API directly

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

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() {}

Current status

⚠️This crate is in its early stages, breaking changes are expected in upcoming releases.

Changelist

  • 0.2.1 - Add a notice about renaming the crate
  • 0.2.0 - [breaking changes] Stop supporting non-blocking macro api
Commit count: 55

cargo fmt