rust icon indicating copy to clipboard operation
rust copied to clipboard

Use futex-based synchronization on Apple platforms

Open joboet opened this issue 11 months ago • 1 comments

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

joboet avatar Mar 12 '24 20:03 joboet

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

rustbot avatar Mar 12 '24 20:03 rustbot

:umbrella: The latest upstream changes (presumably #122423) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Mar 13 '24 10:03 bors