class SignalManager

Properties

protected SignalHandlerInterface[][][] $handlers
protected Repository $config
protected bool $stopped
protected array<int, true> $waiting

Coroutine IDs currently blocked in a cancellable native signal wait.

Methods

__construct(Container $container)

Create a new signal manager instance.

void
init()

Initialize the signal handlers from config.

array
getHandlers()

Get all registered signal handlers.

void
listen(int|null $process)

Start listening for signals for the given process type.

void
stop()

Stop listening for signals in this process.

getQueue()

Build the priority queue of signal handler classes from config.

Details

at line 38
__construct(Container $container)

Create a new signal manager instance.

Parameters

Container $container

at line 49
void init()

Initialize the signal handlers from config.

Boot-only. Reinitializing after listening starts leaves existing watchers using the prior handler set until the process exits.

Return Value

void

at line 69
array getHandlers()

Get all registered signal handlers.

Return Value

array

at line 80
void listen(int|null $process)

Start listening for signals for the given process type.

Boot-only. Each call creates another set of process-lifetime watchers that would invoke the configured handlers again for the same signal.

Parameters

int|null $process

Return Value

void

at line 139
void stop()

Stop listening for signals in this process.

The deregister listener invokes this at worker/process exit. Stopping is terminal and permanently halts signal handling for this process incarnation.

Return Value

void

at line 154
protected SplPriorityQueue getQueue()

Build the priority queue of signal handler classes from config.

Return Value

SplPriorityQueue