protected function tryToStartNewTasks() { if ($this->scheduled->isEmpty() || false === ($threadId = array_search(false, $this->threads, true))) { return; } do { $task = $this->scheduled->dequeue(); $this->dispatchEvent(self::EVENT_TASK_STARTED_PRE, $task, $threadId); $this->threads[$threadId] = $task; $this->runningThreads++; $task->start($threadId); $this->dispatchEvent(self::EVENT_TASK_STARTED_POST, $task, $threadId); } while (!$this->scheduled->isEmpty() && false !== ($threadId = array_search(false, $this->threads, true))); }
/** * Remove task * * @param \ToBeDoneBundle\Entity\Task $task */ public function removeTask(\ToBeDoneBundle\Entity\Task $task) { $this->tasks->removeElement($task); }
/** * @param Task $task */ public function removeDependency(Task $task) { $this->depends->removeElement($task); }