pcntl_signal problem
| From: | Steve Alberty | Date: | Fri, 25 Oct 2002 12:35:05 +0000 |
| Subject: | pcntl_signal problem | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-90110@lists.php.net to get a copy of this message | ||
Hi,
i've a small problem with the signal handler.
These short script demonstrate my problem.
#!/usr/local/bin/php
<?php
set_time_limit(0);
function signals($signo) {
switch($signo) {
case SIGTERM:
echo "Termination signal";
exit;
break;
case SIGINT:
echo "Interrupt from keyboard";
exit
break;
}
}
$result=pcntl_signal(SIGTERM, 'signals');
if ($result == false) echo 'could not install sighandler for TERM';
$result=pcntl_signal(SIGINT, 'signals');
if ($result == false) echo 'could not install sighandler for INT';
echo "goto loop ...\n";
$c=0;
while (true){
$c++;
usleep(1);
}
?>
The problem is, that the script doesnt exit when i'm
sending the TERM signal or pressing CTRL-C (INT signal).
I've test it with the lastest cvs version.
Any help?
Regards,
Steve