-
-
Notifications
You must be signed in to change notification settings - Fork 131
Closed
Labels
Description
In all implementations of \React\EventLoop\LoopInterface::run
$this->signals->isEmpty()is part of the conditions to check if there is something else to do.
This is not really correct, the loop after executing all the added Timers is waiting for a the signals registered to response to and make
$nothingLeftToDobecome true.
It is not really required to wait for the signal, what if the signal is not received? The loop run() keep going until it is either stop() or all the registered signals have been triggered.
Registering signals should mean: what to do if this signal received, and not that registered signals have to be received.
sample
<?php
declare(strict_types=1);
require_once '../../vendor/autoload.php';
$loop = \React\EventLoop\Factory::create();
$loop->addTimer(
0.01,
function () use ($loop) {
$loop->addSignal(
SIGUSR1,
function (int $signal) {
fputs(STDOUT, "signal [$signal] received\n");
}
);
fputs(STDOUT, "in first callback\n");
}
);
$loop->addSignal(
SIGINT,
function (int $signal) {
fputs(STDOUT, "signal [$signal] received\n");
}
);
fputs(STDOUT, "Now it will keep waiting for SIGUSR1 && for SIGINT, clicking Ctrl-c will not end the process \n");
$loop->run();