]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Improve asyncio.loop.call_soon() documentation (GH-20883)
authorRoger Iyengar <ri@rogeriyengar.com>
Tue, 23 Jun 2020 02:16:00 +0000 (22:16 -0400)
committerGitHub <noreply@github.com>
Tue, 23 Jun 2020 02:16:00 +0000 (22:16 -0400)
* Add a glossary entry for the term "callback"
* Link to it in loop.call_soon() and in the "Concurrency and Multithreading" section

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
Doc/glossary.rst
Doc/library/asyncio-dev.rst
Doc/library/asyncio-eventloop.rst

index 6189cb045049c2a20ee59fcf4aa27bfa60b52f17..e997d366777b384390a3a57129319ef3db6bf293 100644 (file)
@@ -189,6 +189,10 @@ Glossary
       A list of bytecode instructions can be found in the documentation for
       :ref:`the dis module <bytecodes>`.
 
+   callback
+      A subroutine function which is passed as an argument to be executed at
+      some point in the future.
+
    class
       A template for creating user-defined objects. Class definitions
       normally contain method definitions which operate on instances of the
index ff51c4fa3b20f47ca2b01e289f1874f17ff20196..77f80671978369f87450b76b6105511f2f5c3007 100644 (file)
@@ -73,7 +73,7 @@ event loop, no other Tasks can run in the same thread.  When a Task
 executes an ``await`` expression, the running Task gets suspended, and
 the event loop executes the next Task.
 
-To schedule a callback from a different OS thread, the
+To schedule a :term:`callback` from another OS thread, the
 :meth:`loop.call_soon_threadsafe` method should be used. Example::
 
     loop.call_soon_threadsafe(callback, *args)
index d60a6ce95cdd87c0a318bb3dcfede61e164d6ec2..b1e73189a7a4cfc07f4a7f78fdb9b3a353d8c02b 100644 (file)
@@ -191,8 +191,8 @@ Scheduling callbacks
 
 .. method:: loop.call_soon(callback, *args, context=None)
 
-   Schedule a *callback* to be called with *args* arguments at
-   the next iteration of the event loop.
+   Schedule the *callback* :term:`callback` to be called with
+   *args* arguments at the next iteration of the event loop.
 
    Callbacks are called in the order in which they are registered.
    Each callback will be called exactly once.