This is automatic generated document for things in Swow\ThreadManager class

Class ThreadManager

Manages a set of worker threads.

The manager starts workers and controls their life cycle. It restarts workers that exit while the manager runs. On POSIX, SIGUSR1 starts a graceful reload. On Windows, SIGBREAK starts it. SIGTERM and SIGINT start a graceful stop.

Methods

Method __construct

public function __construct ( int $workerCount )

Param int $workerCount Number of workers. 0 selects the CPU count.

Method getWorkerCount

public function getWorkerCount ( ) : int

Method onWorkerExit

public function onWorkerExit ( Closure(int $workerId, int $threadId, int $exitStatus): void $callback ) : static

Method reload

public function reload ( ) : void

Method setMaxRestartCount

public function setMaxRestartCount ( int $count ) : static

Method setMaxWaitTime

public function setMaxWaitTime ( int $seconds ) : static

Method start

public function start ( Closure $onWorkerStart ) : void

Method startInline

public function startInline ( string $code ) : void

Method stop

public function stop ( ) : void

Copyright 2022 the Swow contributors