#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

#692 in Concurrency

Download history 47332/week @ 2024-11-22 50608/week @ 2024-11-29 51372/week @ 2024-12-06 49367/week @ 2024-12-13 23635/week @ 2024-12-20 17963/week @ 2024-12-27 44191/week @ 2025-01-03 53550/week @ 2025-01-10 46244/week @ 2025-01-17 52260/week @ 2025-01-24 56641/week @ 2025-01-31 55467/week @ 2025-02-07 48144/week @ 2025-02-14 55654/week @ 2025-02-21 59583/week @ 2025-02-28 51670/week @ 2025-03-07

224,726 downloads per month
Used in 50 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