|
pcntl_async_signalsEnable/disable asynchronous signal handling or return the old setting Description
bool pcntl_async_signals(boolnull
$enable = null)
If the Parameters
Return Values
When used as getter ( Changelog
ExamplesExample #1 Calling signal handlers during a cURL transfer
Without the progress callback, the handler would not be called until the
transfer has completed. NotesWith asynchronous signal handling enabled, a handler installed with pcntl_signal is not called at the moment the signal is received. The signal is recorded, and the handler is called the next time the engine checks for pending signals while executing PHP code, for instance after a function call returns, or on the next iteration of a loop.
As a consequence, a long-running call to an internal function, such as
curl_exec or a database query, is not interrupted to
call the handler: the handler is only called once that function returns.
The handler is called earlier only if the function calls back into PHP code
while it runs, for instance through a
A signal may still interrupt a system call the function is blocked in. For instance, sleep then returns early, and the handler is called once it has returned. See Also |