SAREhub/PHP_Commons

View on GitHub
examples/process/pcntl_signals/1/example.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

use SAREhub\Commons\Process\PcntlSignals;

echo "PcntlSignals example\n\n";
echo "press CTRL+C to call SIGINT signal handler \n";

$signals = PcntlSignals::create()->handle(\SIGINT, function () {
    echo "\nkilled via signal\n";
    exit(0);
});

while (true) {
    $signals->checkPendingSignals();
};