diff options
author | Guido van Rossum <guido@python.org> | 2015-11-19 21:28:47 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2015-11-19 21:28:47 (GMT) |
commit | 41f69f4cc7c977bd202545b8ada01b80a278d0e2 (patch) | |
tree | 10b1e25f8802dd9b5469acf5002c69d6996400c1 /Doc | |
parent | 01a65af4a150a9a81cd92923adef76810e41895a (diff) | |
download | cpython-41f69f4cc7c977bd202545b8ada01b80a278d0e2.zip cpython-41f69f4cc7c977bd202545b8ada01b80a278d0e2.tar.gz cpython-41f69f4cc7c977bd202545b8ada01b80a278d0e2.tar.bz2 |
Issue #25593: Change semantics of EventLoop.stop().
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/asyncio-eventloop.rst | 22 | ||||
-rw-r--r-- | Doc/library/asyncio-protocol.rst | 2 |
2 files changed, 17 insertions, 7 deletions
diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst index e867c80..96468ae 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -29,7 +29,16 @@ Run an event loop .. method:: BaseEventLoop.run_forever() - Run until :meth:`stop` is called. + Run until :meth:`stop` is called. If :meth:`stop` is called before + :meth:`run_forever()` is called, this polls the I/O selector once + with a timeout of zero, runs all callbacks scheduled in response to + I/O events (and those that were already scheduled), and then exits. + If :meth:`stop` is called while :meth:`run_forever` is running, + this will run the current batch of callbacks and then exit. Note + that callbacks scheduled by callbacks will not run in that case; + they will run the next time :meth:`run_forever` is called. + + .. versionchanged:: 3.4.4 .. method:: BaseEventLoop.run_until_complete(future) @@ -48,10 +57,10 @@ Run an event loop Stop running the event loop. - Every callback scheduled before :meth:`stop` is called will run. - Callbacks scheduled after :meth:`stop` is called will not run. - However, those callbacks will run if :meth:`run_forever` is called - again later. + This causes :meth:`run_forever` to exit at the next suitable + opportunity (see there for more details). + + .. versionchanged:: 3.4.4 .. method:: BaseEventLoop.is_closed() @@ -61,7 +70,8 @@ Run an event loop .. method:: BaseEventLoop.close() - Close the event loop. The loop must not be running. + Close the event loop. The loop must not be running. Pending + callbacks will be lost. This clears the queues and shuts down the executor, but does not wait for the executor to finish. diff --git a/Doc/library/asyncio-protocol.rst b/Doc/library/asyncio-protocol.rst index 9350ffe..78faeae 100644 --- a/Doc/library/asyncio-protocol.rst +++ b/Doc/library/asyncio-protocol.rst @@ -494,7 +494,7 @@ data and wait until the connection is closed:: def connection_lost(self, exc): print('The server closed the connection') - print('Stop the event lop') + print('Stop the event loop') self.loop.stop() loop = asyncio.get_event_loop() |