@@ -188,19 +188,21 @@ Running and stopping the loop
188
188
.. coroutinemethod :: loop.shutdown_default_executor(timeout=None)
189
189
190
190
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
193
193
while using the default executor.
194
194
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.
198
198
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.
201
202
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.
204
206
205
207
.. versionadded :: 3.9
206
208
@@ -215,21 +217,21 @@ Scheduling callbacks
215
217
Schedule the *callback * :term: `callback ` to be called with
216
218
*args * arguments at the next iteration of the event loop.
217
219
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 .
220
222
221
223
An optional keyword-only *context * argument allows specifying a
222
224
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.
224
226
225
- An instance of :class: `asyncio.Handle ` is returned , which can be
227
+ Returns an instance of :class: `asyncio.Handle `, which can be
226
228
used later to cancel the callback.
227
229
228
230
This method is not thread-safe.
229
231
230
232
.. method :: loop.call_soon_threadsafe(callback, *args, context=None)
231
233
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
233
235
schedule callbacks *from another thread *.
234
236
235
237
Raises :exc: `RuntimeError ` if called on a loop that's been closed.
0 commit comments