Icicle\Concurrent\Worker\DefaultPool::push PHP Method

push() private method

Pushes the worker back into the queue.
private push ( Worker $worker )
$worker Worker
    private function push(Worker $worker)
    {
        if (!$this->workers->contains($worker)) {
            throw new InvalidArgumentError('The provided worker was not part of this queue.');
        }
        if (0 === ($this->workers[$worker] -= 1)) {
            // Worker is completely idle, remove from busy queue and add to idle queue.
            foreach ($this->busyQueue as $key => $busy) {
                if ($busy === $worker) {
                    unset($this->busyQueue[$key]);
                    break;
                }
            }
            $this->idleWorkers->push($worker);
        }
    }