def process_messages(handler)
      while true
        begin
          message = next_message
        rescue Interrupt
          break
        else
          break if TERM == message[0]
        end

        handler.call(message, @pipe)
      end
    end
def process_messages(handler)
      while true
        begin
          message = next_message
        rescue Interrupt
          break
        else
          break if TERM == message[0]
        end

        handler.call(message, @pipe)
      end
    end
Successively receive messages that were sent to the actor and
 yield them to the given handler to process them. The a pipe (a
 {Socket::PAIR} socket) is also passed to the handler so it can send back
 the result of a command, if needed.

 When a message is "$TERM", or when the waiting for a message is
 interrupted, execution is aborted and the actor will terminate.

 @param handler [Proc, #call] the handler used to process messages
 @yieldparam message [Message] message (e.g. command) received
 @yieldparam pipe [Socket::PAIR] pipe to write back something into the
   actor