mirror of
https://github.com/danog/amp.git
synced 2025-01-22 05:11:42 +01:00
Call posix_kill() in defer for better consistency
Using a short delay was sometimes not long enough to ensure that $sig2 was actually enabled before the signal was sent. Using a defer after enabling pushes the call to posix_kill() to the next tick.
This commit is contained in:
parent
8c2063157b
commit
6fd7fe5b11
11
src/Test.php
11
src/Test.php
@ -577,12 +577,11 @@ abstract class Test extends \PHPUnit_Framework_TestCase {
|
||||
$loop->onSignal(SIGUSR1, $f(5));
|
||||
$loop->defer(function() use ($loop, $sig2) {
|
||||
$loop->enable($sig2);
|
||||
});
|
||||
|
||||
$loop->delay($msDelay = 1, function() use ($loop) {
|
||||
\posix_kill(\getmypid(), \SIGUSR1);
|
||||
$loop->delay($msDelay = 10, function() use ($loop) {
|
||||
$loop->stop();
|
||||
$loop->defer(function() use ($loop) {
|
||||
\posix_kill(\getmypid(), \SIGUSR1);
|
||||
$loop->delay($msDelay = 10, function() use ($loop) {
|
||||
$loop->stop();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user