def shutdown
      fail EventQueueDeadError, 'event queue already dead' if @dead

      queue = []
      @mutex.synchronize do
        @dead = true
        @not_empty.broadcast

        queue = @queue
        @queue.clear
      end
      while !queue.empty?
        discard_message(queue.pop)
      end
      true
    end
def shutdown
      fail EventQueueDeadError, 'event queue already dead' if @dead

      queue = []
      @mutex.synchronize do
        @dead = true
        @not_empty.broadcast

        queue = @queue
        @queue.clear
      end
      while !queue.empty?
        discard_message(queue.pop)
      end
      true
    end
Shut down this event queue and clean it up

 @example
   event_queue.shutdown

 @return [Boolean]

 @api public