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;
}