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

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

#954 in Concurrency

Download history 56211/week @ 2025-08-27 61583/week @ 2025-09-03 59247/week @ 2025-09-10 57504/week @ 2025-09-17 58905/week @ 2025-09-24 56050/week @ 2025-10-01 66032/week @ 2025-10-08 63785/week @ 2025-10-15 62518/week @ 2025-10-22 62835/week @ 2025-10-29 57116/week @ 2025-11-05 49383/week @ 2025-11-12 66300/week @ 2025-11-19 62893/week @ 2025-11-26 73603/week @ 2025-12-03 60006/week @ 2025-12-10

273,534 downloads per month
Used in 61 crates (3 directly)

MIT/Apache

7KB
143 lines

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);

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

No runtime deps