public static function run() { self::$pool or self::$pool = new \SplQueue(); while (!self::$pool->isEmpty()) { $task = self::$pool->dequeue(); $task->run(); if ($task->complete()) { unset(self::$workers[$task->id()]); } else { self::$pool->enqueue($task); } } }