mirror of
https://github.com/danog/amp.git
synced 2024-12-03 09:57:51 +01:00
Merge branch 'master' into v3
This commit is contained in:
commit
ee3c09087b
@ -230,7 +230,12 @@ final class NativeDriver extends Driver
|
||||
return;
|
||||
}
|
||||
|
||||
if ($timeout > 0) { // Otherwise sleep with usleep() if $timeout > 0.
|
||||
if ($timeout < 0) { // Only signal watchers are enabled, so sleep indefinitely.
|
||||
\usleep(\PHP_INT_MAX);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($timeout > 0) { // Sleep until next timer expires.
|
||||
\usleep((int) ($timeout * self::MICROSEC_PER_SEC));
|
||||
}
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ abstract class DriverTest extends TestCase
|
||||
\call_user_func_array([$loop, $type], $args);
|
||||
|
||||
if ($type == "onSignal") {
|
||||
$loop->defer(function (): void {
|
||||
$loop->delay(1, function () {
|
||||
\posix_kill(\getmypid(), \SIGUSR1);
|
||||
});
|
||||
}
|
||||
@ -631,11 +631,11 @@ abstract class DriverTest extends TestCase
|
||||
$loop->onSignal(\SIGUSR1, $fn = function ($watcherId, $signo, $i) use (&$fn, $loop, $sendSignal): void {
|
||||
if ($i) {
|
||||
$loop->onSignal(\SIGUSR1, $fn, --$i);
|
||||
$loop->defer($sendSignal);
|
||||
$loop->delay(1, $sendSignal);
|
||||
}
|
||||
$loop->cancel($watcherId);
|
||||
}, $runs);
|
||||
$loop->defer($sendSignal);
|
||||
$loop->delay(1, $sendSignal);
|
||||
$loop->run();
|
||||
}
|
||||
};
|
||||
@ -783,7 +783,7 @@ abstract class DriverTest extends TestCase
|
||||
$loop->onSignal(SIGUSR1, $f(2));
|
||||
$loop->defer(function () use ($loop, $sig2): void {
|
||||
$loop->enable($sig2);
|
||||
$loop->defer(function () use ($loop): void {
|
||||
$loop->delay(1, function () use ($loop) {
|
||||
\posix_kill(\getmypid(), \SIGUSR1);
|
||||
$loop->delay($msDelay = 10, function () use ($loop): void {
|
||||
$loop->stop();
|
||||
|
Loading…
Reference in New Issue
Block a user