diff --git a/examples/event-loop/signals.php b/examples/event-loop/signals.php index ee7a91fa..d1462faf 100644 --- a/examples/event-loop/signals.php +++ b/examples/event-loop/signals.php @@ -7,9 +7,14 @@ print "Press Ctrl+C to exit..." . PHP_EOL; -Loop::onSignal(SIGINT, function () { +Loop::onSignal(SIGINT, function ($watcherId) { print "Caught SIGINT, exiting..." . PHP_EOL; + + Loop::cancel($watcherId); + exit(0); }); Loop::run(); + +exit(0);