/** * Submits an asynchronous task to a specific Worker in the Pool * * @param AsyncTask $task * @param int $worker * * @return void */ public function scheduleAsyncTaskToWorker(AsyncTask $task, $worker) { if ($task->getTaskId() !== null) { throw new \UnexpectedValueException("Attempt to schedule the same AsyncTask instance twice"); } $id = $this->nextId(); $task->setTaskId($id); $task->progressUpdates = new \Threaded(); $this->asyncPool->submitTaskToWorker($task, $worker); }
/** * Submits an asynchronous task to a specific Worker in the Pool * * @param AsyncTask $task * @param int $worker * * @return void */ public function scheduleAsyncTaskToWorker(AsyncTask $task, $worker) { $id = $this->nextId(); $task->setTaskId($id); $this->asyncPool->submitTaskToWorker($task, $worker); }