Closed santossoares closed 1 year ago
Hello! Idk if this is expected or not, but when using sleep on the main php process, the script wakes up after the child process it's execution.
See this example:
$pool = Pool::create(); $pool->add(function () { sleep(2); return 'end'; })->then(function ($output){ echo $output; });
echo "first sleep".PHP_EOL; sleep(20);
echo "second sleep".PHP_EOL; sleep(5);
$pool->wait();
After 2 seconds, the sleep(20) gets interrupted. Then, the code continues to execute as expected.
You need install php-pcntl and php-posix.
Thx. I'll try this and see if the output changes.
Hello! Idk if this is expected or not, but when using sleep on the main php process, the script wakes up after the child process it's execution.
See this example:
$pool = Pool::create(); $pool->add(function () { sleep(2); return 'end'; })->then(function ($output){ echo $output; });
echo "first sleep".PHP_EOL; sleep(20);
echo "second sleep".PHP_EOL; sleep(5);
$pool->wait();
After 2 seconds, the sleep(20) gets interrupted. Then, the code continues to execute as expected.