protected function getNextFreeWorker() {
		$sec = 0;
		while (TRUE) {
			$this->collectWorkerResults($sec);

			$freeProcess = $this->workerProcesses->takeFreeProcess();
			if ($freeProcess !== NULL) {
				return $freeProcess;
			}

			$sec = $this->child_timeout_sec;
			if ($this->workerPoolSize <= 0) {
				throw new WorkerPoolException('All workers were gone.');
			}
		}

		return NULL;
	}