public Msg recvpipe(Pipe[] pipe_) {
        //  Deallocate old content of the message.
        Msg msg_;

        //  Round-robin over the pipes to get the next message.
        while (active > 0) {

            //  Try to fetch new message. If we've already read part of the message
            //  subsequent part should be immediately available.
            msg_ = pipes.get(current).read ();

            boolean fetched = msg_ != null;

            //  Note that when message is not fetched, current pipe is deactivated
            //  and replaced by another active pipe. Thus we don't have to increase
            //  the 'current' pointer.
            if (fetched) {
                if (pipe_ != null)
                    pipe_[0] = pipes.get(current);
                more = msg_.has_more();
                if (!more)
                    current = (current + 1) % active;
                return msg_;
            }
            
            //  Check the atomicity of the message.
            //  If we've already received the first part of the message
            //  we should get the remaining parts without blocking.
            assert (!more);
            
            active--;
            Utils.swap (pipes, current, active);
            if (current == active)
                current = 0;
        }

        //  No message is available. Initialise the output parameter
        //  to be a 0-byte message.
        ZError.errno(ZError.EAGAIN);
        return null;
    }