From cf82f3872a47b32a8f841637a6317dabbd2b2955 Mon Sep 17 00:00:00 2001 From: Jason Greene Date: Sun, 30 Sep 2001 08:34:46 +0000 Subject: [PATCH] Added not about not supporting Windows Removed SIG_ constants from signal list Modified pcntl_signal example to be more verbose git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@58748 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/pcntl.xml | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/functions/pcntl.xml b/functions/pcntl.xml index c944a38f83..88e29d4a0f 100644 --- a/functions/pcntl.xml +++ b/functions/pcntl.xml @@ -1,5 +1,5 @@ - + Process Control Functions PCNTL @@ -27,6 +27,12 @@ configuration option when compiling PHP to enable Process Control support. + + + Currently, this module will not function on non-Unix platforms + (Windows). + + The following list of signals are supported by the Process Control functions. Please see your systems signal(7) man page for details @@ -36,17 +42,12 @@ - SIG_IGN SIGFPE SIGCONT - - - SIG_DFL SIGKILL - SIGSTOP - SIG_ERR + SIGSTOP SIGUSR1 SIGTSTP @@ -243,14 +244,10 @@ if ($pid == -1) { &false; on failure. - <function>pcntl_fork</function> Example + <function>pcntl_signal</function> Example <?php -// setup signal handlers -pcntl_signal(SIGTERM, "sig_handler"); -pcntl_signal(SIGHUP, "sig_handler"); - // signal handler function function sig_handler($signo) { @@ -262,12 +259,30 @@ function sig_handler($signo) { case SIGHUP: // handle restart tasks break; + case SIGUSR1: + print "Caught SIGUSR1...\n"; + break; default: // handle all other signals } } + +print "Installing signal handler...\n"; + +// setup signal handlers +pcntl_signal(SIGTERM, "sig_handler"); +pcntl_signal(SIGHUP, "sig_handler"); +pcntl_signal(SIGUSR1, "sig_handler"); + +print "Generating signal SIGTERM to self...\n"; + +// send SIGUSR1 to current process id +posix_kill(posix_getpid(), SIGUSR1); + +print "Done\n" + ?>