pcntl_sigprocmask
Description
The pcntl_sigprocmask of PCNTL for PHP sets and retrieves blocked signals.
Syntax
pcntl_sigprocmask( int $mode, array $signals, array &$old_signals = null ): bool
Parameters
mode
Sets the behavior.
Constant | Description |
---|---|
SIG_BLOCK | Add the signals to the currently blocked signals. |
SIG_UNBLOCK | Remove the signals from the currently blocked signals. |
SIG_SETMASK | Replace the currently blocked signals by the given list of signals. |
signals
The list of signals.
old_signals
The list of the previously blocked signals.
Return
Returns true on success or false on failure.
Examples
1 · mode · SIG_BLOCK · signals
<? $mode = SIG_BLOCK; $signals = [ SIGHUP ]; $return = pcntl_sigprocmask($mode, $signals); var_export($return); ?>
true
2 · mode · SIG_UNBLOCK · signals
<? $mode = SIG_UNBLOCK; $signals = [ SIGHUP ]; $return = pcntl_sigprocmask($mode, $signals); var_export($return); ?>
true
3 · mode · SIG_SETMASK · signals
<? $mode = SIG_SETMASK; $signals = [ SIGHUP ]; $return = pcntl_sigprocmask($mode, $signals); var_export($return); ?>
true
4 · old_signals
<? $mode = SIG_BLOCK; $signals = [ SIGHUP ]; $return = pcntl_sigprocmask($mode, $signals, $old_signals); var_export($return); echo PHP_EOL; print_r($old_signals); ?>
true Array ( [0] => 1 )
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_signal_get_handler
- pcntl_sigtimedwait
- pcntl_sigwaitinfo
- pcntl_strerror
- pcntl_unshare
- pcntl_wait
- pcntl_waitpid
- pcntl_wexitstatus
- pcntl_wifexited
- pcntl_wifsignaled
- pcntl_wifstopped
- pcntl_wstopsig
- pcntl_wtermsig