note 48022 deleted from function.pcntl-signal by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 10:13:22 +0000 |
| Subject: | note 48022 deleted from function.pcntl-signal by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-196907@lists.php.net to get a copy of this message | ||
Note Submitter: cp at ltur dot de
----
@spam at etcpasswd dot de
Yes it is possible to use a Handler inside of a Class:
<?php
declare(ticks = 1);
class SignalHandler
{
function __construct() {
$this->_init();
}
function _init() {
pcntl_signal(SIGTERM, array(&$this,"handleSignals"));
}
function handleSignals($signal)
{
echo "$signal\n";
}
}
$o = new SignalHandler();
posix_kill(getmypid(),SIGTERM);
// prints 15
?>
HTH
.Ape