on until there are no more scheduled events.
If *blocking* is False executes the scheduled events due to expire soonest
- (if any) and then return.
+ (if any) and then return the deadline of the next scheduled call in the
+ scheduler (if any).
Either *action* or *delayfunc* can raise an exception. In either case, the
scheduler will maintain a consistent state and propagate the exception. If an
def run(self, blocking=True):
"""Execute events until the queue is empty.
If blocking is False executes the scheduled events due to
- expire soonest (if any) and then return.
+ expire soonest (if any) and then return the deadline of the
+ next scheduled call in the scheduler.
When there is a positive delay until the first event, the
delay function is called and the event is left in the queue;
now = timefunc()
if now < time:
if not blocking:
- return
+ return time - now
delayfunc(time - now)
else:
event = pop(q)