#access #mutex #synchronized #safe #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

#540 in Concurrency

Download history 28683/week @ 2024-02-27 33423/week @ 2024-03-05 27601/week @ 2024-03-12 29789/week @ 2024-03-19 27022/week @ 2024-03-26 30302/week @ 2024-04-02 31052/week @ 2024-04-09 33045/week @ 2024-04-16 31029/week @ 2024-04-23 29984/week @ 2024-04-30 31472/week @ 2024-05-07 36946/week @ 2024-05-14 34467/week @ 2024-05-21 29323/week @ 2024-05-28 30429/week @ 2024-06-04 24009/week @ 2024-06-11

124,940 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