#linux #futex #mutex #rwlock #condvar

no-std rustix-futex-sync

Linux futex-based synchronization

8 releases

0.2.1 Dec 4, 2023
0.2.0 Dec 4, 2023
0.1.5 Oct 9, 2023
0.1.3 Aug 27, 2023

#251 in Unix APIs

Download history 201/week @ 2023-12-22 233/week @ 2023-12-29 117/week @ 2024-01-05 53/week @ 2024-01-12 118/week @ 2024-01-19 56/week @ 2024-01-26 46/week @ 2024-02-02 92/week @ 2024-02-09 145/week @ 2024-02-16 193/week @ 2024-02-23 129/week @ 2024-03-01 282/week @ 2024-03-08 75/week @ 2024-03-15 77/week @ 2024-03-22 130/week @ 2024-03-29 43/week @ 2024-04-05

331 downloads per month
Used in 11 crates (5 directly)

Apache-2.0…

81KB
909 lines

rustix-futex-sync

Linux futex-based synchronization

Github Actions CI Status zulip chat crates.io page docs.rs docs

Linux futex-based implementations of Mutex, RwLock, Condvar, Once, and OnceLock, as well as RawMutex, RawRwLock, and RawCondvar, derived from the futex code in std, factored out to a standalone no_std crate using rustix to do the futex and lock_api to provide most of the public Mutex and RwLock API.

lock_api does not support poisoning, so support for poisoning is omitted.

In this library, Condvar, RawCondvar, RawMutex, and Once are guaranteed to be repr(transparent) wrappers around a single AtomicU32. RawRwLock is guaranteed to be a repr(C) wrapper around two AtomicU32s. The contents of these AtomicU32s are not documented, except that all these types' const fn new() and INIT are guaranteed to initialize them to all zeros.

Dependencies

~2–12MB
~122K SLoC