PHPDaemon\Thread\Master::stopWorkers PHP Method

stopWorkers() protected method

Stop the workers
protected stopWorkers ( $n = 1 ) : boolean
$n - integer - number of workers to stop
return boolean - success
    protected function stopWorkers($n = 1)
    {
        Daemon::log('--' . $n . '-- ' . Debug::backtrace() . '-----');
        $n = (int) $n;
        $i = 0;
        foreach ($this->workers->threads as &$w) {
            if ($i >= $n) {
                break;
            }
            if ($w->shutdown) {
                continue;
            }
            if ($w->reloaded) {
                continue;
            }
            $w->stop();
            ++$i;
        }
        $this->lastMpmActionTs = microtime(true);
        return true;
    }