SignalRegistry
class SignalRegistry
Resolve one shared instance per process through the container. Separate instances create competing native waits for the same signal and lose earlier handlers.
Properties
| protected array<int, array<int, array{owner: object, callback: callable(int): mixed}>> | $signalHandlers | The callbacks registered for each signal. |
|
| protected array<int, int> | $handling | The coroutine responsible for waiting and dispatching each signal. |
|
| protected array<int, true> | $dispatching | The signals whose callbacks are currently running. |
|
| protected int | $nextRegistrationId |
Methods
Register a signal handler for one or more signals.
Unregister an owner's handlers for one, many, or all signals.
Release a signal once its last registration has been removed.
Spawn a coroutine to wait for the given signal and invoke registered handlers.
Cancel the coroutine waiting on the given signal.
Details
at line 47
void
register(object $owner, int|iterable $signals, callable $callback)
Register a signal handler for one or more signals.
at line 74
void
unregister(object $owner, int|iterable|null $signals = null)
Unregister an owner's handlers for one, many, or all signals.
at line 90
protected void
removeEmptySignal(int $signal)
Release a signal once its last registration has been removed.
at line 101
protected void
waitSignal(int $signo)
Spawn a coroutine to wait for the given signal and invoke registered handlers.
at line 143
protected void
cancelSignal(int $signo)
Cancel the coroutine waiting on the given signal.