mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
Another stab in the dark to fix the intermittent failures of timeout tests on macos CI: We're using ITIMER_PROF, which means that the timer counts against user+system time. The "busy" wait loop counts against real time. Currently it calls microtime() on every iteration. If that call is implemented as a syscall rather than going through vDSO or commpage we might be seeing many context switches here which drive up the real time, but not user or system time. See if making the loop busier and calling microtime() less helps the situation.
11 lines
183 B
PHP
11 lines
183 B
PHP
<?php
|
|
|
|
$t = 3;
|
|
|
|
function busy_wait($how_long) {
|
|
$until = microtime(true) + $how_long;
|
|
do {
|
|
for ($i = 0; $i < 1000000; $i++);
|
|
} while ($until > microtime(true));
|
|
}
|