diff options
author | Jason Greene <jason@php.net> | 2002-08-22 04:20:10 +0000 |
---|---|---|
committer | Jason Greene <jason@php.net> | 2002-08-22 04:20:10 +0000 |
commit | 261a60a3604912c70b5176cde5118198ba8a1b70 (patch) | |
tree | 323e79ac5229d4615ad78448e2f08887256dacfc /ext/pcntl/test-pcntl.php | |
parent | faff3a6e8a5892461486a25db178d1105017e8f5 (diff) | |
download | php-git-261a60a3604912c70b5176cde5118198ba8a1b70.tar.gz |
@Made major improvents to the pcntl extension(Jason):
@ - Greatly improved performance, by switching the signal callback mechanism
@ to use ticks
@ - Implemented object signal callback ability by using array($obj, $method)
@ - Added a restart parameter to pcntl_signal, which allows you to disable
@ the default of system call restarting
Changed callback hash table to be initialized and destroyed per reqeust
(allows the ability to use request life zvals as handles)
Nuked warnings
Modified test script to adjust to new ticks backend
Some slight WS fixes
Diffstat (limited to 'ext/pcntl/test-pcntl.php')
-rwxr-xr-x | ext/pcntl/test-pcntl.php | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/ext/pcntl/test-pcntl.php b/ext/pcntl/test-pcntl.php index 41334ba814..6b3ee5649e 100755 --- a/ext/pcntl/test-pcntl.php +++ b/ext/pcntl/test-pcntl.php @@ -1,35 +1,39 @@ -#!/opt/devel/php4/php -q +#!../../php -q <? + +declare(ticks=1); + function alarm_handle($signal){ if ($signal==SIGALRM) print "Caught SIGALRM!!!\n"; } + function usr1_handle($signal){ - if ($signal==SIGUSR1) print "Caught SIGUSR1!!!\n"; + if ($signal==SIGUSR1) print "Caught SIGUSR1!!!\n"; } print "This test will demonstrate a fork followed by ipc via signals.\n"; $pid=pcntl_fork(); if ($pid==0) { - pcntl_signal(SIGUSR1, "usr1_handle"); - pcntl_signal(SIGALRM, "alarm_handle"); - print "Child: Waiting for alarm.....\n"; - sleep(100); - print "Child: Waiting for usr1......\n"; - sleep(100); - print "Child: Resetting Alarm handler to Ignore....\n"; - pcntl_signal(SIGALRM, SIG_IGN); - sleep(10); - print "Done\n"; + pcntl_signal(SIGUSR1, "usr1_handle"); + pcntl_signal(SIGALRM, "alarm_handle"); + print "Child: Waiting for alarm.....\n"; + sleep(100); + print "Child: Waiting for usr1......\n"; + sleep(100); + print "Child: Resetting Alarm handler to Ignore....\n"; + pcntl_signal(SIGALRM, SIG_IGN); + sleep(10); + print "Done\n"; } else { - print "Parent: Waiting 10 seconds....\n"; - sleep(10); - print "Parent: Sending SIGALRM to Child\n"; - posix_kill($pid,SIGALRM); - sleep(1); - print "Parent: Senging SIGUSR1 to Child\n"; - posix_kill($pid,SIGUSR1); - sleep(1); - print "Parent: Sending SIGALRM to Child\n"; - pcntl_waitpid($pid, &$status, $options); + print "Parent: Waiting 10 seconds....\n"; + sleep(10); + print "Parent: Sending SIGALRM to Child\n"; + posix_kill($pid,SIGALRM); + sleep(1); + print "Parent: Senging SIGUSR1 to Child\n"; + posix_kill($pid,SIGUSR1); + sleep(1); + print "Parent: Sending SIGALRM to Child\n"; + pcntl_waitpid($pid, &$status, $options); } |