rust
rust copied to clipboard
Use futex-based synchronization on Apple platforms
Last week, Apple released macOS version 14.4, which introduced a public futex API called os_sync_wait_on_address
(Apple has failed to include the documentation provided in the defining header os/os_sync_wait_on_address.h
on its website). As the private API backing these functions has been around since macOS 10.12, our minimum supported version, it can be used as fallback without risking breakage in future versions.
This PR thus switches over Mutex
to os_unfair_lock
, which is movable and supports priority inheritance, and all other synchronization primitives (Condvar
, RwLock
, Once
and thread parking) to the futex-based ones also used on Linux and Windows.
TODO: implement miri shims
r? @m-ou-se
rustbot has assigned @m-ou-se. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.
Use r? to explicitly pick a reviewer
:umbrella: The latest upstream changes (presumably #122423) made this pull request unmergeable. Please resolve the merge conflicts.