1) { $this->channel = new Channel($taskWorker); for ($i = 0; $i < $taskWorker; $i++) { Coroutine::create(function () { while ($this->channel->capacity) { $data = $this->channel->pop(-1); $execute = $this->getContainer()->get(OnServerTask::class); $task = new Task(); $task->data = $data; $execute->onCoroutineTask(null, $task); } }); } } } public function dispatch($data) { $this->channel->push($data); } }