Repository navigation
fix(libc): use precise Windows thread sleep - #8129
Merged
oneandonlydean merged 1 commit intoOct 20, 2026
Merged
Conversation
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
_Thrd_sleepuses winpthreadsnanosleepon Windows, which truncates sub-millisecond requests and can finish millisecond waits on 15.6 ms clock steps. Use the existing high-resolution waitable-timer helper for the bounded relative wait, rounding up to 100 ns, then recheck the absolute realtime deadline.The existing xtime normalization, one-day chunk bound, past-deadline behavior and POSIX
nanosleeppath remain intact. Add guest-API checks for 100 us and 2 ms deadlines and a broad 12 ms median bound over 31 samples. Keep the existing cancellation/console-contract gaps explicit in libc technical debt.Related to #1471; this addresses only
_Thrd_sleep. #7735 changes condition-variable waits in the same source file, independently of this function.Tested
Windows 11 Pro (26300), AMD Ryzen 7 9800X3D, WinLibs MinGW-w64 GCC 15.2.0 r7, Release build. No title or console verification.
7c2334d20835a4126ec8c8ba4af32735c4535eed, the 2 ms guest sleep median was 15,527,800 ns andguest_ampr_threadsfailed the 12 ms bound; the other three guest thread/import tests passed.precise_wait,guest_libc_threads,guest_libc_static_imports,guest_libc_cnd_timed_wait, andguest_ampr_threads. The 2 ms guest sleep median was 2,005,500 ns. Existing past, normalized-positive/negative xtime and null-target checks passed. Every sampled short sleep was checked against its absolute realtime deadline.606ebafd203c016ec18b8501a1f50a76ad52bf02: 5/5 passed.python tools/check_conventions.py --base origin/main: passed.python tools/pr_overlap.py --branch codex/libc-precise-thread-sleep --repo boykopovar/AnyPS5: completed with no confirmed overlaps. Manually inspected the shared files flagged for stale/conflicting PRs feat(aot): discuss native ARM64 compiler architecture and integration #1835, feat(aot): consolidate native ARM64 compiler, runtime and consumers #5021, fix(libc): follow measured wide printf behavior #5303, test: organize library tests and label CTest suites #6044, fix(libc): find a relinked module by stem when the exact name misses #6226, fix(memory): honor low guest mapping hints #6469, feat(libc): answer every libunwind cursor slot of an unwind context #6819, feat(wasm): run relinked titles in the browser with WebGPU #6879, fix(libs): share Sony CRT handler and lconv state between libc and libSceAmpr #7081, Macos port #7201, feat: macOS on Apple Silicon host support (Rosetta 2 and MoltenVK) #7332, feat(libc): scan 16-bit wide conversions on Linux #7386, perf(libc): skip write-watch queries for proven clean resident ranges #7473 and fix(libc): provide ASOBI_ROOT environment variable for title path resolution #7715: the Threads.cpp changes affect_Cnd_timedwait, the debt changes affect other entries, and test: organize library tests and label CTest suites #6044 moves GuestAmprThreads.cpp unchanged into tests/memory. No other PR implements this sleep fix. fix(libc): avoid coarse Windows C++ condition waits #7735 also merges independently.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)