public function stop() { for ($n = 0; $n < $this->threads; ++$n) { $this->workers[$n]->close(); Server::microSleep(50000); $this->workers[$n]->kill(); } @socket_close($this->socket); $this->threads = 0; }
public function removeTasks() { do { foreach ($this->tasks as $task) { $task->cancelRun(); $this->removeTask($task); } if (count($this->tasks) > 0) { Server::microSleep(25000); } } while (count($this->tasks) > 0); for ($i = 0; $i < $this->size; ++$i) { $this->workerUsage[$i] = 0; } $this->taskWorkers = []; $this->tasks = []; }