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

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
Download history 6421/week @ 2020-07-21 6294/week @ 2020-07-28 6153/week @ 2020-08-04 6066/week @ 2020-08-11 5808/week @ 2020-08-18 5304/week @ 2020-08-25 5053/week @ 2020-09-01 3987/week @ 2020-09-08 3829/week @ 2020-09-15 3790/week @ 2020-09-22 3725/week @ 2020-09-29 3558/week @ 2020-10-06 3481/week @ 2020-10-13 3303/week @ 2020-10-20 4145/week @ 2020-10-27 3943/week @ 2020-11-03

23,907 downloads per month
Used in 14 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

# use oncemutex::OnceMutex;

let mutex = OnceMutex::new(8);

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

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

No runtime deps