Add run_forever().

This commit is contained in:
Guido van Rossum 2012-12-20 13:48:24 -08:00
parent 7821b363da
commit 34a462cfe0
1 changed files with 3 additions and 1 deletions

View File

@ -171,7 +171,7 @@ A conforming event loop object has the following methods:
Note: if you schedule a call with ``call_repeatedly()``, ``run()`` Note: if you schedule a call with ``call_repeatedly()``, ``run()``
will not exit until you cancel it. will not exit until you cancel it.
TBD: A method to run the loop forever, i.e. until ``stop()`` is called? TBD: How many variants of this do we really need?
- ``stop()``. Stops the event loop as soon as it is convenient. It - ``stop()``. Stops the event loop as soon as it is convenient. It
is fine to restart the loop with ``run()`` (or one of its variants) is fine to restart the loop with ``run()`` (or one of its variants)
@ -182,6 +182,8 @@ A conforming event loop object has the following methods:
called must still be run, but callbacks scheduled after it is called called must still be run, but callbacks scheduled after it is called
(or scheduled to be run later) will not be run. (or scheduled to be run later) will not be run.
- ``run_forever()``. Runs the event loop until ``stop()`` is called.
- ``run_until_complete(future, timeout=None)``. Runs the event loop - ``run_until_complete(future, timeout=None)``. Runs the event loop
until the Future is done. If a timeout is given, it waits at most until the Future is done. If a timeout is given, it waits at most
that long. If the Future is done, its result is returned, or its that long. If the Future is done, its result is returned, or its