private function cleanup()
    {
        foreach ($this->threads as $i => $szal)
            if (!$szal->isAlive()) {
                $this->results[] = $this->threads[$i]->result;
                unset($this->threads[$i]);
            }
        return count($this->threads);
    }