'Run all pending timed calls.'

def runUntilCurrent(self):

    if self.threadCallQueue:
        count = 0
        total = len(self.threadCallQueue)
        for (f, a, kw) in self.threadCallQueue:
            try:
                f(*a, **kw)
            except:
                log.err()
            count += 1
            if (count == total):
                break
        del self.threadCallQueue[:count]
        if self.threadCallQueue:
            self.wakeUp()
    self._insertNewDelayedCalls()
    now = self.seconds()
    while (self._pendingTimedCalls and (self._pendingTimedCalls[0].time <= now)):
        call = heappop(self._pendingTimedCalls)
        if call.cancelled:
            self._cancellations -= 1
            continue
        if (call.delayed_time > 0):
            call.activate_delay()
            heappush(self._pendingTimedCalls, call)
            continue
        try:
            call.called = 1
            call.func(*call.args, **call.kw)
        except:
            log.deferr()
            if hasattr(call, 'creator'):
                e = '\n'
                e += ('    C:    previous    exception    occurred    in    ' + 'a    DelayedCall    created    here:\n')
                e += '    C:'
                e += ''.join(call.creator).rstrip().replace('\n', '\n    C:')
                e += '\n'
                log.msg(e)
    if ((self._cancellations > 50) and (self._cancellations > (len(self._pendingTimedCalls) >> 1))):
        self._cancellations = 0
        self._pendingTimedCalls = [x for x in self._pendingTimedCalls if (not x.cancelled)]
        heapify(self._pendingTimedCalls)
    if self._justStopped:
        self._justStopped = False
        self.fireSystemEvent('shutdown')
