Example #1
0
 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)));
 }
Example #2
0
 /**
  * Remove task
  *
  * @param \ToBeDoneBundle\Entity\Task $task
  */
 public function removeTask(\ToBeDoneBundle\Entity\Task $task)
 {
     $this->tasks->removeElement($task);
 }
Example #3
0
 /**
  * @param Task $task
  */
 public function removeDependency(Task $task)
 {
     $this->depends->removeElement($task);
 }