pcntl_sigprocmask
PHP function
Edit on GitHub ✎
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
Sets and retrieves blocked signals
Description
pcntl_sigprocmask(int $mode, array $signals, array $old_signals = null): bool
The pcntl_sigprocmask() function adds, removes or sets blocked signals, depending on the mode parameter.
Parameters
modeSets the behavior of
pcntl_sigprocmask(). Possible values: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.
signalsList of signals.
old_signalsThe
old_signalsparameter is set to an array containing the list of the previously blocked signals.
Return Values
Success
Changelog
| Version | Description |
|---|---|
| 8.4.0 | A ValueError is thrown if signals is empty, unless mode is SIG_SETMASK. |
| 8.4.0 | A TypeError is thrown if signals value is not an int. |
| 8.4.0 | A ValueError is thrown if signals value is invalid. |
| 8.4.0 | A ValueError is thrown if mode value is not SIG_BLOCK, SIG_UNBLOCK or SIG_SETMASK. |
Examples
pcntl_sigprocmask() example
php
<?php
pcntl_sigprocmask(SIG_BLOCK, array(SIGHUP));
$oldset = array();
pcntl_sigprocmask(SIG_UNBLOCK, array(SIGHUP), $oldset);
?>