Skip to content

Commit 7c3fb58

Browse files
committed
Apply first pass edits
Loop run/stop section, and callbacks section.
1 parent b7e4f1d commit 7c3fb58

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

Doc/library/asyncio-eventloop.rst

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -188,19 +188,21 @@ Running and stopping the loop
188188
.. coroutinemethod:: loop.shutdown_default_executor(timeout=None)
189189

190190
Schedule the closure of the default executor and wait for it to join all of
191-
the threads in the :class:`ThreadPoolExecutor`. After calling this method, a
192-
:exc:`RuntimeError` will be raised if :meth:`loop.run_in_executor` is called
191+
the threads in the :class:`ThreadPoolExecutor`. After calling this method,
192+
:meth:`loop.run_in_executor` will raise a :exc:`RuntimeError` if called
193193
while using the default executor.
194194

195-
The *timeout* parameter specifies the amount of time the executor will
196-
be given to finish joining. The default value is ``None``, which means the
197-
executor will be given an unlimited amount of time.
195+
The *timeout* parameter specifies the amount of time this method gives the
196+
executor to finish joining. The default value is ``None``, which means the
197+
method allows the executor an unlimited amount of time.
198198

199-
If the timeout duration is reached, a warning is emitted and executor is
200-
terminated without waiting for its threads to finish joining.
199+
If the timeout duration is reached, this method emits a warning and
200+
terminates the default executor without waiting for its threads to finish
201+
joining.
201202

202-
Note that there is no need to call this function when
203-
:func:`asyncio.run` is used.
203+
Note that there is no need to call this function when :func:`asyncio.run` is
204+
used, because that high-level function handles default executor shutdown
205+
automatically.
204206

205207
.. versionadded:: 3.9
206208

@@ -215,21 +217,21 @@ Scheduling callbacks
215217
Schedule the *callback* :term:`callback` to be called with
216218
*args* arguments at the next iteration of the event loop.
217219

218-
Callbacks are called in the order in which they are registered.
219-
Each callback will be called exactly once.
220+
Callbacks are called in the order in which they are registered. Each callback
221+
will be called exactly once, even if it is registered multiple times.
220222

221223
An optional keyword-only *context* argument allows specifying a
222224
custom :class:`contextvars.Context` for the *callback* to run in.
223-
The current context is used when no *context* is provided.
225+
Callbacks use the current context when no *context* is provided.
224226

225-
An instance of :class:`asyncio.Handle` is returned, which can be
227+
Returns an instance of :class:`asyncio.Handle`, which can be
226228
used later to cancel the callback.
227229

228230
This method is not thread-safe.
229231

230232
.. method:: loop.call_soon_threadsafe(callback, *args, context=None)
231233

232-
A thread-safe variant of :meth:`call_soon`. Must be used to
234+
A thread-safe variant of :meth:`call_soon`. This method *must* be used to
233235
schedule callbacks *from another thread*.
234236

235237
Raises :exc:`RuntimeError` if called on a loop that's been closed.

0 commit comments

Comments
 (0)