]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
(sched) when run() is invoked with blocking=False return the deadline of the next...
authorGiampaolo Rodola' <g.rodola@gmail.com>
Thu, 15 Mar 2012 12:05:41 +0000 (13:05 +0100)
committerGiampaolo Rodola' <g.rodola@gmail.com>
Thu, 15 Mar 2012 12:05:41 +0000 (13:05 +0100)
Doc/library/sched.rst
Lib/sched.py

index 957bdd3d2b654e7c7ac411897e15ac3fed5a7cf2..d6c86c79e7a277f6c3bcce449706a649368be31a 100644 (file)
@@ -109,7 +109,8 @@ Scheduler Objects
    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
index bd1f42734a703f6fb5984e627626af9d935c2225..a89a11878863ff59bc2f9c2dd31018466ca4a1d5 100644 (file)
@@ -97,7 +97,8 @@ class scheduler:
     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;
@@ -129,7 +130,7 @@ class scheduler:
                 now = timefunc()
                 if now < time:
                     if not blocking:
-                        return
+                        return time - now
                     delayfunc(time - now)
                 else:
                     event = pop(q)