Skip to content

Commit b4939fd

Browse files
committed
Update some docs
1 parent 4b285b8 commit b4939fd

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Doc/library/concurrent.futures.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,19 @@ to a :class:`ProcessPoolExecutor` will result in deadlock.
415415
require the *fork* start method for :class:`ProcessPoolExecutor` you must
416416
explicitly pass ``mp_context=multiprocessing.get_context("fork")``.
417417

418+
.. method:: terminate_workers(signal=signal.SIGTERM)
419+
420+
Attempt to terminate all living worker processes immediately by sending each
421+
of them the given signal. If the signal is not specified, the default signal
422+
:data:`signal.SIGTERM` is used.
423+
424+
After calling :meth:`ProcessPoolExecutor.terminate_workers`, the caller, should
425+
no longer submit tasks to the executor. It is also recommended to still call
426+
:meth:`ProcessPoolExecutor.shutdown` to ensure that all other resources
427+
associated with the executor are freed.
428+
429+
.. versionadded:: 3.14
430+
418431
.. _processpoolexecutor-example:
419432

420433
ProcessPoolExecutor Example

Doc/whatsnew/3.14.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,9 @@ concurrent.futures
306306
incompatible *fork* start method you must explicitly request it by
307307
supplying a *mp_context* to :class:`concurrent.futures.ProcessPoolExecutor`.
308308
(Contributed by Gregory P. Smith in :gh:`84559`.)
309+
* Add :meth:`concurrent.futures.ProcessPoolExecutor.terminate_workers` as
310+
a way to terminate all living worker processes in the given pool.
311+
(Contributed by Charles Machalow in :gh:`128043`.)
309312

310313
ctypes
311314
------

0 commit comments

Comments
 (0)