Skip to content

Conversation

@joboet
Copy link
Member

@joboet joboet commented Jan 23, 2026

std currently only uses waitable timer objects if the CREATE_WAITABLE_TIMER_HIGH_RESOLUTION is supported (which got added in Windows 10, version 1803), and falls back to Sleep otherwise. This is unfortunate, as Sleep only allows specifying the duration in milliseconds and can actually round down the sleep duration (see #149935). Waitable timer objects (supported since Vista), on the other hand, allow expressing the duration in 100 ns units and don't round down. Thus, it's better to use them even if the system doesn't make use of the added precision. I've kept the zero-duration behaviour of Sleep, just to be safe.

Fixes #149935
Draft until I implement miri support for WTOs.

@rustbot rustbot added 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 Jan 23, 2026
@rust-log-analyzer
Copy link
Collaborator

The job tidy failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
finished building tool typos
error: `RESULTION` should be `RESOLUTION`
    ╭▸ library/std/src/sys/thread/windows.rs:125:17
    │
125 │     static HIGH_RESULTION_SUPPORTED: Atomic<bool> = AtomicBool::new(true);
    ╰╴                ━━━━━━━━━
error: `RESULTION` should be `RESOLUTION`
    ╭▸ library/std/src/sys/thread/windows.rs:136:29
    │
136 │         let flags = if HIGH_RESULTION_SUPPORTED.load(Relaxed) {
    ╰╴                            ━━━━━━━━━
error: `RESULTION` should be `RESOLUTION`
    ╭▸ library/std/src/sys/thread/windows.rs:150:26
    │
150 │                     HIGH_RESULTION_SUPPORTED.store(false, Relaxed);
    ╰╴                         ━━━━━━━━━
rerun tidy with `--extra-checks=spellcheck --bless` to fix typos
tidy [extra_checks]: checks with external tool 'typos' failed
tidy [extra_checks]: FAIL
tidy: The following check failed: extra_checks
Bootstrap failed while executing `test src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck`
Command `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools-bin/rust-tidy /checkout /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo /checkout/obj/build 4 /node/bin/yarn --extra-checks=py,cpp,js,spellcheck` failed with exit code 1
Created at: src/bootstrap/src/core/build_steps/tool.rs:1612:23
Executed at: src/bootstrap/src/core/build_steps/test.rs:1358:29

Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:02:43
  local time: Fri Jan 23 20:58:53 UTC 2026
  network time: Fri, 23 Jan 2026 20:58:53 GMT
##[error]Process completed with exit code 1.
##[group]Run echo "disk usage:"

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 25, 2026

☔ The latest upstream changes (presumably #151634) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The thread::sleep_until test frequently fails under Windows 7

3 participants