Join 4,000+ others and never miss out on new tips, tutorials, and more.
Latest version:
pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5
<?php OpenSwoole\Process::signal ( string $signal_no , callable $callback ) : bool
the signal number
the callback function called when the signal is triggered
Setup signal callback function.
<?php
OpenSwoole\Process::signal(SIGALRM, function () {
static $i = 0;
echo "#{$i}\talarm\n";
$i++;
if ($i > 20) {
OpenSwoole\Process::alarm(-1);
}
});
//100ms
OpenSwoole\Process::alarm(100 * 1000);