mirror of
https://github.com/danog/amp.git
synced 2024-12-12 09:29:45 +01:00
Merge branch 'master' into v3
This commit is contained in:
commit
ee3c09087b
@ -230,7 +230,12 @@ final class NativeDriver extends Driver
|
|||||||
return;
|
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));
|
\usleep((int) ($timeout * self::MICROSEC_PER_SEC));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -360,7 +360,7 @@ abstract class DriverTest extends TestCase
|
|||||||
\call_user_func_array([$loop, $type], $args);
|
\call_user_func_array([$loop, $type], $args);
|
||||||
|
|
||||||
if ($type == "onSignal") {
|
if ($type == "onSignal") {
|
||||||
$loop->defer(function (): void {
|
$loop->delay(1, function () {
|
||||||
\posix_kill(\getmypid(), \SIGUSR1);
|
\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 {
|
$loop->onSignal(\SIGUSR1, $fn = function ($watcherId, $signo, $i) use (&$fn, $loop, $sendSignal): void {
|
||||||
if ($i) {
|
if ($i) {
|
||||||
$loop->onSignal(\SIGUSR1, $fn, --$i);
|
$loop->onSignal(\SIGUSR1, $fn, --$i);
|
||||||
$loop->defer($sendSignal);
|
$loop->delay(1, $sendSignal);
|
||||||
}
|
}
|
||||||
$loop->cancel($watcherId);
|
$loop->cancel($watcherId);
|
||||||
}, $runs);
|
}, $runs);
|
||||||
$loop->defer($sendSignal);
|
$loop->delay(1, $sendSignal);
|
||||||
$loop->run();
|
$loop->run();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -783,7 +783,7 @@ abstract class DriverTest extends TestCase
|
|||||||
$loop->onSignal(SIGUSR1, $f(2));
|
$loop->onSignal(SIGUSR1, $f(2));
|
||||||
$loop->defer(function () use ($loop, $sig2): void {
|
$loop->defer(function () use ($loop, $sig2): void {
|
||||||
$loop->enable($sig2);
|
$loop->enable($sig2);
|
||||||
$loop->defer(function () use ($loop): void {
|
$loop->delay(1, function () use ($loop) {
|
||||||
\posix_kill(\getmypid(), \SIGUSR1);
|
\posix_kill(\getmypid(), \SIGUSR1);
|
||||||
$loop->delay($msDelay = 10, function () use ($loop): void {
|
$loop->delay($msDelay = 10, function () use ($loop): void {
|
||||||
$loop->stop();
|
$loop->stop();
|
||||||
|
Loading…
Reference in New Issue
Block a user