#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

#5 in #synchronized

Download history 27269/week @ 2024-08-20 28369/week @ 2024-08-27 42355/week @ 2024-09-03 43915/week @ 2024-09-10 43392/week @ 2024-09-17 46554/week @ 2024-09-24 48194/week @ 2024-10-01 40485/week @ 2024-10-08 43740/week @ 2024-10-15 52141/week @ 2024-10-22 46080/week @ 2024-10-29 50345/week @ 2024-11-05 52111/week @ 2024-11-12 54971/week @ 2024-11-19 45182/week @ 2024-11-26 43739/week @ 2024-12-03

204,330 downloads per month
Used in 47 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