pcntl_signal_get_handler
Description
The pcntl_signal_get_handler of PCNTL for PHP gets the current handler for the specified signal.
Syntax
pcntl_signal_get_handler( int $signal ): callable|int
Parameters
signal
The signal number.
Return
Returns the integer value that refers to SIG_DFL or SIG_IGN or the callable if a custom handler has been set.
Examples
1 · signal
<? $signal = SIGHUP; $return = pcntl_signal_get_handler($signal); echo $return; ?>
0
2 · pcntl_signal · handler · SIG_DFL
<? $signal = SIGHUP; $handler = SIG_DFL; pcntl_signal($signal, $handler); $return = pcntl_signal_get_handler($signal); echo $return; ?>
0
3 · pcntl_signal · handler · SIG_IGN
<? $signal = SIGHUP; $handler = SIG_IGN; pcntl_signal($signal, $handler); $return = pcntl_signal_get_handler($signal); echo $return; ?>
1
4 · pcntl_signal · handler · callable
<? function handler($signo, $siginfo) { } $signal = SIGHUP; $handler = "handler"; pcntl_signal($signal, $handler); $return = pcntl_signal_get_handler($signal); echo $return; ?>
handler
Links
PCNTL
- pcntl_alarm
- pcntl_async_signals
- pcntl_errno
- pcntl_exec
- pcntl_fork
- pcntl_get_last_error
- pcntl_getpriority
- pcntl_rfork
- pcntl_setpriority
- pcntl_signal
- pcntl_signal_dispatch
- pcntl_sigprocmask
- pcntl_sigtimedwait
- pcntl_sigwaitinfo
- pcntl_strerror
- pcntl_unshare
- pcntl_wait
- pcntl_waitpid
- pcntl_wexitstatus
- pcntl_wifexited
- pcntl_wifsignaled
- pcntl_wifstopped
- pcntl_wstopsig
- pcntl_wtermsig