Skip to content

std: move futex implementations into sys::sync::futex - #158726

Open
valentynkit wants to merge 2 commits into
rust-lang:mainfrom
valentynkit:sys-sync-futex
Open

std: move futex implementations into sys::sync::futex#158726
valentynkit wants to merge 2 commits into
rust-lang:mainfrom
valentynkit:sys-sync-futex

Conversation

@valentynkit

@valentynkit valentynkit commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Part of #117276.

Moves the futex primitives out of the per-platform sys::pal modules into a single sys::sync::futex, selected with cfg_select! the same way the other sys::sync backends are.
Every consumer of these primitives already lives in sys::sync (mutex, rwlock, once, condvar, thread_parking), so they now import crate::sys::sync::futex directly instead of reaching crate::sys::futex through the pub use pal::* glob.

I placed it under sys::sync rather than a top-level sys::futex because the futex API only backs the sys::sync primitives and sits next to the existing sys::sync::thread_parking backend.

Happy to place it to sys::futex if you would rather have it as a peer of the other feature modules.

The file moves are a separate commit, recorded in .git-blame-ignore-revs so blame skips the rename.

r? joboet

@rustbot

rustbot commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

joboet is currently at their maximum review capacity.
They may take a while to respond.

@rustbot rustbot added A-meta Area: Issues & PRs about the rust-lang/rust repository itself O-hermit Operating System: Hermit O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-wasm Target: WASM (WebAssembly), http://webassembly.org/ O-windows Operating system: Windows S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 3, 2026
@valentynkit
valentynkit marked this pull request as ready for review July 3, 2026 15:06
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 3, 2026
Pure file moves; the module path repointing and platform gating follow
in the next commit. Recorded in .git-blame-ignore-revs so blame skips
the rename.
Select the platform implementation with a cfg_select! in sys::sync::futex,
repoint each one at the pal primitives it uses (time, fuchsia, the windows
api module, hermit_abi), and remove the now-unused futex declarations from
the pal modules. The sync primitives import crate::sys::sync::futex rather
than the crate::sys::futex glob re-export.
@rustbot

rustbot commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@valentynkit

valentynkit commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto master, and extended the move to cover the wasi futex from #159731, which landed in pal after this was opened.
r? libs

@rustbot rustbot assigned Darksonn and unassigned joboet Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-meta Area: Issues & PRs about the rust-lang/rust repository itself O-hermit Operating System: Hermit O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-wasm Target: WASM (WebAssembly), http://webassembly.org/ O-windows Operating system: Windows S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants