wg = new WaitGroup(); } public function create(callable $callable): void { $this->wg->add(); $callable = function () use ($callable) { try { $callable(); } finally { $this->wg->done(); } }; parent::create($callable); } public function wait(float $timeout = -1): bool { return $this->wg->wait($timeout); } }