public function attach(Process $process)
    {
        if ($this->stopped) {
            throw new RuntimeException('Could not attach child to non-running pool');
        }

        $firstProcess = $this->getFirstProcess();
        if ($this->isRunning()
            && $firstProcess instanceof Process
            && $this->count() >= $this->processLimit) {
            $firstProcess->wait();
            $this->detach($firstProcess);
        }
        $this->process->attach($process);

        if ($this->isRunning()) {
            $process->start();
        }
    }