Skip to content

Commit 56d25ad

Browse files
Improve asyncio.loop.call_soon() documentation (GH-20883)
* 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 a16d697) Co-authored-by: Roger Iyengar <ri@rogeriyengar.com>
1 parent d7f37d1 commit 56d25ad

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

Doc/glossary.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ Glossary
189189
A list of bytecode instructions can be found in the documentation for
190190
:ref:`the dis module <bytecodes>`.
191191

192+
callback
193+
A subroutine function which is passed as an argument to be executed at
194+
some point in the future.
195+
192196
class
193197
A template for creating user-defined objects. Class definitions
194198
normally contain method definitions which operate on instances of the

Doc/library/asyncio-dev.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ event loop, no other Tasks can run in the same thread. When a Task
7373
executes an ``await`` expression, the running Task gets suspended, and
7474
the event loop executes the next Task.
7575

76-
To schedule a callback from a different OS thread, the
76+
To schedule a :term:`callback` from another OS thread, the
7777
:meth:`loop.call_soon_threadsafe` method should be used. Example::
7878

7979
loop.call_soon_threadsafe(callback, *args)

Doc/library/asyncio-eventloop.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ Scheduling callbacks
179179

180180
.. method:: loop.call_soon(callback, *args, context=None)
181181

182-
Schedule a *callback* to be called with *args* arguments at
183-
the next iteration of the event loop.
182+
Schedule the *callback* :term:`callback` to be called with
183+
*args* arguments at the next iteration of the event loop.
184184

185185
Callbacks are called in the order in which they are registered.
186186
Each callback will be called exactly once.

0 commit comments

Comments
 (0)