aboutsummaryrefslogtreecommitdiffstats
path: root/test/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/test.c')
-rw-r--r--test/test.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/test.c b/test/test.c
index aeb2b4058..7d4e3f2b0 100644
--- a/test/test.c
+++ b/test/test.c
@@ -177,13 +177,18 @@ void test_wait_threads(void) {
#if CH_DBG_THREADS_PROFILING
void test_cpu_pulse(unsigned duration) {
+ systime_t start, end, now;
- systime_t end = chThdSelf()->p_time + MS2ST(duration);
- while (chThdSelf()->p_time < end) {
+ start = chThdSelf()->p_time;
+ end = start + MS2ST(duration);
+ do {
+ now = chThdSelf()->p_time;
#if defined(WIN32)
ChkIntSources();
#endif
}
+ while (end > start ? (now >= start) && (now < end) :
+ (now >= start) || (now < end));
}
#endif