private function waitForStreamsToChange(array $modified)
    {
        $write = [];
        $except = [];
        $result = stream_select($modified, $write, $except, 1);
        if ($result === false) {
            throw new \RuntimeException('stream_select() returned an error while waiting for all workers to finish.');
        }
        $this->modified = $modified;

        return $result;
    }