1
0
mirror of https://github.com/danog/amp.git synced 2025-01-22 21:31:18 +01:00

Merge pull request #84 from async-interop/signal_handlers_in_different_loops

Add a warning/implementation note about installing handlers for a same signal on different loops
This commit is contained in:
Cees-Jan Kiewiet 2016-07-30 20:50:01 +02:00 committed by GitHub
commit 6b1da28fb8
2 changed files with 7 additions and 0 deletions

View File

@ -199,6 +199,9 @@ final class Loop
/**
* Execute a callback when a signal is received.
*
* WARNING: Installing a handler on the same signal on different scopes of event loop execution is
* undefined behavior and may break things arbitrarily.
*
* @param int $signo The signal number to monitor.
* @param callable(string $watcherId, int $signo, mixed $data) $callback The callback to execute.
* @param mixed $data Arbitrary data given to the callback function as the $data parameter.

View File

@ -100,6 +100,10 @@ interface Driver
*
* Multiple watchers on the same signal may be executed in any order.
*
* NOTE: Installing a same signal on different instances of this interface is deemed undefined behavior.
* Implementations may try to detect this, if possible, but are not required to.
* This is due to technical limitations of the signals being registered globally per process.
*
* @param int $signo The signal number to monitor.
* @param callable(string $watcherId, int $signo, mixed $data) $callback The callback to execute.
* @param mixed $data Arbitrary data given to the callback function as the $data parameter.