diff options
author | Giampaolo Rodola' <g.rodola@gmail.com> | 2011-12-14 13:38:45 (GMT) |
---|---|---|
committer | Giampaolo Rodola' <g.rodola@gmail.com> | 2011-12-14 13:38:45 (GMT) |
commit | 556ba04a8d07bf9d0996410ecda809d337f51885 (patch) | |
tree | 92c16f0dfc492ed425a1fbaf2cb4655db6748645 /Doc/library/sched.rst | |
parent | 73520d57ebfb1272d009a070191e749caebf64ae (diff) | |
download | cpython-556ba04a8d07bf9d0996410ecda809d337f51885.zip cpython-556ba04a8d07bf9d0996410ecda809d337f51885.tar.gz cpython-556ba04a8d07bf9d0996410ecda809d337f51885.tar.bz2 |
Fix #13449: add 'blocking' parameter to sched.scheduler.run() so that the scheduler can be used in non-blocking applications
Diffstat (limited to 'Doc/library/sched.rst')
-rw-r--r-- | Doc/library/sched.rst | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Doc/library/sched.rst b/Doc/library/sched.rst index 455cc70..957bdd3 100644 --- a/Doc/library/sched.rst +++ b/Doc/library/sched.rst @@ -102,12 +102,15 @@ Scheduler Objects Return true if the event queue is empty. -.. method:: scheduler.run() +.. method:: scheduler.run(blocking=True) - Run all scheduled events. This function will wait (using the :func:`delayfunc` + Run all scheduled events. This method will wait (using the :func:`delayfunc` function passed to the constructor) for the next event, then execute it and so 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. + Either *action* or *delayfunc* can raise an exception. In either case, the scheduler will maintain a consistent state and propagate the exception. If an exception is raised by *action*, the event will not be attempted in future calls @@ -118,6 +121,9 @@ Scheduler Objects the calling code is responsible for canceling events which are no longer pertinent. + .. versionadded:: 3.3 + *blocking* parameter was added. + .. attribute:: scheduler.queue Read-only attribute returning a list of upcoming events in the order they |