'Plays messages in the queue until empty and _allow_updates is False.'

@concurrency.serialized
def run(self):

    while (self._message_queue and (self._message_queue[0].time < time.time())):
        self._message_queue.popleft()
    while True:
        while self._message_queue:
            delta = (self._message_queue[0].time - time.time())
            if (delta > 0):
                self._update_cv.wait(timeout=delta)
            else:
                msg = self._message_queue.popleft()
                if (msg.type == 'note_on'):
                    self._open_notes.add(msg.note)
                elif (msg.type == 'note_off'):
                    self._open_notes.discard(msg.note)
                self._outport.send(msg)
        if self._allow_updates:
            self._update_cv.wait()
        else:
            break
