Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use u32 instead of i32 for futexes. #96040

Merged
merged 1 commit into from
Apr 15, 2022
Merged

Conversation

m-ou-se
Copy link
Member

@m-ou-se m-ou-se commented Apr 14, 2022

This changes futexes from i32 to u32. The Linux man page uses uint32_t for them, so I'm not sure why I used i32 for them. Maybe because I first used them for thread parkers, where I used -1, 0, and 1 as the states.

(Wasm's memory.atomic.wait32 does use i32, because wasm doesn't support u32.)

It doesn't matter much, but using the unsigned type probably results in fewer surprises when shifting bits around or using comparison operators.

r? @Amanieu

@m-ou-se m-ou-se added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Apr 14, 2022
@rust-highfive

This comment was marked as off-topic.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 14, 2022
@Amanieu
Copy link
Member

Amanieu commented Apr 14, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Apr 14, 2022

📌 Commit 7a35c0f has been approved by Amanieu

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 14, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 14, 2022
Use u32 instead of i32 for futexes.

This changes futexes from i32 to u32. The [Linux man page](https://man7.org/linux/man-pages/man2/futex.2.html) uses `uint32_t` for them, so I'm not sure why I used i32 for them. Maybe because I first used them for thread parkers, where I used -1, 0, and 1 as the states.

(Wasm's `memory.atomic.wait32` does use `i32`, because wasm doesn't support `u32`.)

It doesn't matter much, but using the unsigned type probably results in fewer surprises when shifting bits around or using comparison operators.

r? `@Amanieu`
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 15, 2022
Use u32 instead of i32 for futexes.

This changes futexes from i32 to u32. The [Linux man page](https://man7.org/linux/man-pages/man2/futex.2.html) uses `uint32_t` for them, so I'm not sure why I used i32 for them. Maybe because I first used them for thread parkers, where I used -1, 0, and 1 as the states.

(Wasm's `memory.atomic.wait32` does use `i32`, because wasm doesn't support `u32`.)

It doesn't matter much, but using the unsigned type probably results in fewer surprises when shifting bits around or using comparison operators.

r? ``@Amanieu``
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 15, 2022
Rollup of 11 pull requests

Successful merges:

 - rust-lang#94457 (Stabilize `derive_default_enum`)
 - rust-lang#94461 (Create (unstable) 2024 edition)
 - rust-lang#94849 (Check var scope if it exist)
 - rust-lang#95194 (remove find_use_placement)
 - rust-lang#95749 (only downgrade selection Error -> Ambiguous if type error is in predicate)
 - rust-lang#96026 (couple of clippy::complexity fixes)
 - rust-lang#96027 (remove function parameters only used in recursion)
 - rust-lang#96034 ([test] Add test cases of untested functions for BTreeSet )
 - rust-lang#96040 (Use u32 instead of i32 for futexes.)
 - rust-lang#96062 (docs: Update tests chapter for Termination stabilization)
 - rust-lang#96065 (Refactor: Use `format-args-capture` and remove unnecessary nested blocks in rustc_typeck)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit aa978ad into rust-lang:master Apr 15, 2022
@rustbot rustbot added this to the 1.62.0 milestone Apr 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

5 participants