protected function waitAll($check)
    {
        do {
            $n = 0;

            foreach ($this->collections as &$col) {
                $n += $col->removeTerminated($check);
            }
            if (!$this->waitPid()) {
                $this->sigwait(0, 20000);
            }
        } while ($n > 0);
    }