This is automatic generated document for things in Swow\Process\ProcessManagerTrait class
Trait ProcessManagerTrait
Shared process manager lifecycle.
The manager starts workers and controls their life cycle. It restarts workers that exit with an error. On POSIX, SIGUSR1 starts a graceful reload. On Windows, SIGBREAK starts it. SIGTERM and SIGINT start a graceful stop.
Properties
Methods
Method __construct
Param int $workerCount Number of workers. 0 selects the CPU count.
Method createWorker
Method enforceWorkerShutdownTimeout
Method getWorkerCount
Method handleSignals
Run the manager loop.
The manager handles signals and collects workers. Each worker has a wait coroutine. The coroutine restarts the worker when necessary. The manager waits for the coroutines that it owns. After stop, the signal coroutines exit by timeout.
Method onWorkerExit
Set the worker exit callback.
The callback runs in the manager process. It receives the worker ID, PID, and exit status.
Method reload
Reload all workers one by one without downtime.
Method runManagedCoroutine
Method setMaxRestartCount
Maximum number of restarts after an error. The manager does not restart the worker after this limit.
Method setMaxWaitTime
Maximum time in seconds to wait for a graceful stop. The manager uses SIGKILL after this time.
Method startManager
Method stop
Stop all workers gracefully.
Method watchWorker
Start a monitor coroutine for a worker. The coroutine restarts the worker according to the restart policy.