Bug #17558: pcntl_signal() does not call user-defined function handler
| From: | clay at killersoft dot com | Date: | Sun, 02 Jun 2002 03:27:52 +0000 |
| Subject: | Bug #17558: pcntl_signal() does not call user-defined function handler | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-9128@lists.php.net to get a copy of this message | ||
From: clay@killersoft.com
Operating system: Mac OS X
PHP version: 4.2.1
PHP Bug Type: Unknown/Other Function
Bug description: pcntl_signal() does not call user-defined function handler
function: pcntl_signal()
problem: If "handler" argument is set to a user-defined
function, that function is never called.
script: (taken from www.php.net/pcntl_signal)
<?php
// signal handler function
function sig_handler($signo) {
echo "We hit the sig_handler!\n";
switch($signo) {
case SIGTERM:
// handle shutdown tasks
exit;
break;
case SIGHUP:
// handle restart tasks
break;
case 1:
print "Caught sig 1 ...\n";
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"
?>
The "we hit the sig handler!" echo never appears ... thus I
suspect it's never being called.
--
Edit bug report at http://bugs.php.net/?id=17558&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=17558&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=17558&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=17558&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=17558&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=17558&r=support
Expected behavior: http://bugs.php.net/fix.php?id=17558&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=17558&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=17558&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=17558&r=globals