]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Improve asyncio.loop.call_soon() documentation (GH-20883)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 23 Jun 2020 02:23:49 +0000 (19:23 -0700)
committerGitHub <noreply@github.com>
Tue, 23 Jun 2020 02:23:49 +0000 (19:23 -0700)
* 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>
(cherry picked from commit a16d6970496cae5ecab5aaea2b416a4b77527cc2)

Co-authored-by: Roger Iyengar <ri@rogeriyengar.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 101e7817a95e98e638dc2d89c5cd34b0b71bb30f..0d302ea49b0de525f5aad89442718b181a3353c2 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 9022993e619a59c8c021daa3899e36f72abfef53..32bc219cf5c376c0244f0421106f9ce6cd83287f 100644 (file)
@@ -179,8 +179,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.