Created
February 8, 2014 23:13
-
-
Save andreyst/8891788 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| declare(ticks = 1); // needed | |
| function sig_handler($signo) { | |
| echo "Caught $signo...\n"; | |
| } | |
| pcntl_signal(SIGUSR1, "sig_handler"); | |
| echo 'Hi!' . PHP_EOL; | |
| for ($i = 0; $i < 30; $i++) { | |
| sleep(1); // because signals wake us up, need to sleep again | |
| } | |
| echo 'Bye!' . PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment