#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

#1087 in Concurrency

Download history 73356/week @ 2025-12-07 79028/week @ 2025-12-14 33167/week @ 2025-12-21 36303/week @ 2025-12-28 61645/week @ 2026-01-04 84922/week @ 2026-01-11 99380/week @ 2026-01-18 109666/week @ 2026-01-25 109604/week @ 2026-02-01 109978/week @ 2026-02-08 101075/week @ 2026-02-15 110454/week @ 2026-02-22 140353/week @ 2026-03-01 144099/week @ 2026-03-08 165959/week @ 2026-03-15 144254/week @ 2026-03-22

600,050 downloads per month
Used in 105 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