#futex #mutex #rwlock #condvar #linux

no-std rustix-futex-sync

Linux futex-based synchronization

10 releases

0.2.3 Aug 27, 2024
0.2.2 Jun 12, 2024
0.2.1 Dec 4, 2023
0.1.5 Oct 9, 2023
0.1.3 Aug 27, 2023

#104 in Concurrency

Download history 35/week @ 2024-07-29 23/week @ 2024-08-05 47/week @ 2024-08-12 202/week @ 2024-08-19 289/week @ 2024-08-26 32/week @ 2024-09-02 31/week @ 2024-09-09 65/week @ 2024-09-16 121/week @ 2024-09-23 257/week @ 2024-09-30 700/week @ 2024-10-07 249/week @ 2024-10-14 85/week @ 2024-10-21 69/week @ 2024-10-28 51/week @ 2024-11-04 67/week @ 2024-11-11

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

Apache-2.0…

88KB
975 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

~1.6–9.5MB
~115K SLoC