Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Handle timeBeginPeriod failure before applying tight bounds, and consider centralizing duplicated setup.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
What changed in this PR
This PR requests a 1 ms Windows timer resolution before measurements and tightens timing assertions across the test suite.
Changes:
- Dynamically loads
timeBeginPeriodfromWINMM.DLL. - Tightens timeout and sleep bounds across C, C++, C11, Gthreads, libc++, and native tests.
- Adds stricter bounds for short and immediate-return cases.
| File | Reviewed change |
|---|---|
test/winnt_timeout.c |
Adds timer setup and tighter native timeout bounds; setup result is unchecked and initialization is duplicated. |
test/timed_mutex_try_lock_until.cpp |
Tightens timed-mutex timing assertions; setup result is unchecked. |
test/timed_mutex_try_lock_for.cpp |
Tightens timed-mutex timing assertions; setup result is unchecked. |
test/thread_sleep.c |
Tightens sleep timing assertions; setup result is unchecked. |
test/this_thread_sleep_until.cpp |
Tightens sleep-until assertions; setup result is unchecked. |
test/this_thread_sleep_for.cpp |
Tightens sleep-for assertions; setup result is unchecked. |
test/shared_timed_mutex_try_lock_shared_until.cpp |
Tightens shared timed-mutex assertions; setup result is unchecked. |
test/shared_timed_mutex_try_lock_shared_for.cpp |
Tightens shared timed-mutex assertions; setup result is unchecked. |
test/shared_timed_mutex_try_lock_exclusive_until.cpp |
Tightens exclusive timed-mutex assertions; setup result is unchecked. |
test/shared_timed_mutex_try_lock_exclusive_for.cpp |
Tightens exclusive timed-mutex assertions; setup result is unchecked. |
test/shared_mutex_timeout.c |
Tightens shared-mutex timeout bounds; setup result is unchecked. |
test/sem_timeout.c |
Tightens semaphore timeout bounds; setup result is unchecked. |
test/recursive_timed_mutex_try_lock_until.cpp |
Tightens recursive timed-mutex assertions; setup result is unchecked. |
test/recursive_timed_mutex_try_lock_for.cpp |
Tightens recursive timed-mutex assertions; setup result is unchecked. |
test/once_timeout.c |
Tightens one-time initialization timeout bounds; setup result is unchecked. |
test/mutex_timeout.c |
Tightens mutex timeout bounds; setup result is unchecked. |
test/libcxx_sleep.c |
Tightens libc++ sleep bounds; setup result is unchecked. |
test/libcxx_condvar_timeout.c |
Tightens libc++ condition-variable bounds; setup result is unchecked. |
test/gthr_rc_mutex_timeout.c |
Tightens recursive Gthreads mutex bounds; setup result is unchecked. |
test/gthr_mutex_timeout.c |
Tightens Gthreads mutex bounds; setup result is unchecked. |
test/gthr_cond_timeout.c |
Tightens Gthreads condition-variable bounds; setup result is unchecked. |
test/event_timeout.c |
Tightens event timeout bounds; setup result is unchecked. |
test/condition_variable_wait_until.cpp |
Tightens condition-variable timing assertions; setup result is unchecked. |
test/condition_variable_wait_for.cpp |
Tightens condition-variable timing assertions; setup result is unchecked. |
test/cond_timeout.c |
Tightens native condition timeout bounds; setup result is unchecked. |
test/c11_thrd_sleep.c |
Tightens C11 sleep bounds; setup result is unchecked. |
test/c11_mtx_timeout.c |
Tightens C11 mutex timeout bounds; setup result is unchecked. |
test/c11_mtx_timeout_unsupported.c |
Tightens unsupported C11 mutex timing bounds; setup result is unchecked. |
test/c11_mtx_recursive_timeout.c |
Tightens recursive C11 mutex bounds; setup result is unchecked. |
test/c11_cnd_timeout.c |
Tightens C11 condition timeout bounds; setup result is unchecked. |
test/c11__thrd_sleep_until.c |
Tightens C11 sleep-until bounds; setup result is unchecked. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Assisted-by: DeepSeek V4.1 Flash Signed-off-by: LIU Hao <lh_mouse@126.com>
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.

Assisted-by: DeepSeek V4.1 Flash