Icicle\Concurrent\Forking\Fork::join PHP Method

join() public method

public join ( ) : Generator
return Generator
    public function join() : \Generator
    {
        if (null === $this->channel) {
            throw new StatusError('The fork has not been started or has already finished.');
        }
        try {
            $response = (yield from $this->channel->receive());
            if (!$response instanceof ExitStatus) {
                throw new SynchronizationError(sprintf('Did not receive an exit status from fork. Instead received data of type %s', is_object($response) ? get_class($response) : gettype($response)));
            }
            return $response->getResult();
        } finally {
            $this->kill();
        }
    }