PHPDaemon\Thread\Generic::waitPid PHP Method

waitPid() protected method

Checks for SIGCHLD
protected waitPid ( ) : boolean
return boolean Success
    protected function waitPid()
    {
        start:
        $pid = \pcntl_waitpid(-1, $status, WNOHANG);
        if ($pid > 0) {
            foreach ($this->collections as $col) {
                foreach ($col->threads as $k => $t) {
                    if ($t->pid === $pid) {
                        $t->setTerminated();
                        unset($col->threads[$k]);
                        goto start;
                    }
                }
            }
        }
        return false;
    }