#access #mutex #safe #synchronized #lock-free #one-time #once

oncemutex

A mutex providing one-time synchronized access, then safe unsynchronized access

8 releases

Uses old Rust 2015

0.1.1 Jan 12, 2016
0.1.0 Jan 12, 2016
0.0.6 Feb 6, 2015
0.0.5 Dec 16, 2014

#592 in Concurrency

Download history 24854/week @ 2024-01-05 25046/week @ 2024-01-12 25552/week @ 2024-01-19 25861/week @ 2024-01-26 24998/week @ 2024-02-02 25491/week @ 2024-02-09 27210/week @ 2024-02-16 29070/week @ 2024-02-23 32427/week @ 2024-03-01 29312/week @ 2024-03-08 29870/week @ 2024-03-15 28318/week @ 2024-03-22 27765/week @ 2024-03-29 29620/week @ 2024-04-05 32384/week @ 2024-04-12 26938/week @ 2024-04-19

121,984 downloads per month
Used in 40 crates (3 directly)

MIT/Apache

7KB
143 lines

OnceMutex

A mutex providing one-time synchronized access, then safe lock-free access.

Usage

Use the crates.io repository; add this to your Cargo.toml along with the rest of your dependencies:

[dependencies]
once-mutex = "*"

Author

Jonathan Reem is the primary author and maintainer of OnceMutex.

License

MIT/Apache-2.0


lib.rs:

A mutex which can only be locked once, but which provides very fast concurrent reads after the first lock is over.

Example


let mutex = OnceMutex::new(8);

// One-time lock
*mutex.lock().unwrap() = 9;

// Cheap lock-free access.
assert_eq!(*mutex, 9);

No runtime deps