diff --git a/Doc/library/concurrent.futures.rst b/Doc/library/concurrent.futures.rst index 3c8d9ab111e09e..8112fb987adfdb 100644 --- a/Doc/library/concurrent.futures.rst +++ b/Doc/library/concurrent.futures.rst @@ -114,7 +114,7 @@ Executor Objects e.submit(shutil.copy, 'src4.txt', 'dest4.txt') .. versionchanged:: 3.9 - Added *cancel_futures*. + Added the *cancel_futures* parameter. ThreadPoolExecutor @@ -154,7 +154,8 @@ And:: executor.submit(wait_on_future) -.. class:: ThreadPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=()) +.. class:: ThreadPoolExecutor(max_workers=None, thread_name_prefix='', \ + initializer=None, initargs=(), **ctxkwargs) An :class:`Executor` subclass that uses a pool of at most *max_workers* threads to execute calls asynchronously. @@ -201,6 +202,15 @@ And:: Default value of *max_workers* is changed to ``min(32, (os.process_cpu_count() or 1) + 4)``. + .. versionchanged:: 3.14 + Added *ctxkwargs* to pass additional arguments to ``cls.prepare_context`` + class method. + + .. classmethod:: prepare_context(initializer, initargs) + Setting up the necessary context for creating worker instances in a pool-based executor (e.g., in a concurrent environment like threads or interpreters). + + .. versionadded:: 3.14 + .. _threadpoolexecutor-example: @@ -287,7 +297,8 @@ efficient alternative is to serialize with :mod:`pickle` and then send the bytes over a shared :mod:`socket ` or :func:`pipe `. -.. class:: InterpreterPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=(), shared=None) +.. class:: InterpreterPoolExecutor(max_workers=None, thread_name_prefix='', \ + initializer=None, initargs=(), shared=None) A :class:`ThreadPoolExecutor` subclass that executes calls asynchronously using a pool of at most *max_workers* threads. Each thread runs @@ -357,7 +368,9 @@ that :class:`ProcessPoolExecutor` will not work in the interactive interpreter. Calling :class:`Executor` or :class:`Future` methods from a callable submitted to a :class:`ProcessPoolExecutor` will result in deadlock. -.. class:: ProcessPoolExecutor(max_workers=None, mp_context=None, initializer=None, initargs=(), max_tasks_per_child=None) +.. class:: ProcessPoolExecutor(max_workers=None, mp_context=None, \ + initializer=None, initargs=(), \ + max_tasks_per_child=None) An :class:`Executor` subclass that executes calls asynchronously using a pool of at most *max_workers* processes. If *max_workers* is ``None`` or not pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy