0) { $this->channel = new Channel(1); $this->channel->pop(); } else { while ($this->wait) { usleep(1000); } } } /** * @return void */ public function wait(): void { $this->wait = true; $this->channel = null; } /** * @return void */ public function done(): void { $this->wait = false; $this->channel?->push(true); } }