def run(self):
self._running = True<EOL>whenRunning = self._whenRunning<EOL>self._whenRunning = None<EOL>for callable in whenRunning:<EOL><INDENT>callable()<EOL><DEDENT>while self._running:<EOL><INDENT>calls = self.getDelayedCalls()<EOL>if not calls:<EOL><INDENT>raise RuntimeError("<STR_LIT>")<EOL><DEDENT>self._clock.advance(calls[<NUM_LIT:0>].getTime() - self.seconds())<EOL><DEDENT>shutdownTriggers = self._shutdownTriggers<EOL>self._shutdownTriggers = None<EOL>for (trigger, args) in shutdownTriggers['<STR_LIT>'] + shutdownTriggers['<STR_LIT>']:<EOL><INDENT>trigger(*args)<EOL><DEDENT>
Call timed events until there are no more or the reactor is stopped.

@raise RuntimeError: When no timed events are left and the reactor is
    still running.