diff options
author | Sam Ezeh <sam.z.ezeh@gmail.com> | 2022-11-27 17:58:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-27 17:58:39 (GMT) |
commit | dfc2732a57e3ea6603d62f769d4f9c80be726fa4 (patch) | |
tree | ce2913d2d17a246e571eacb373b347c31e0009e1 /Doc/library/multiprocessing.rst | |
parent | 969620d59ab12fc55d0e757a6fbee6aff29830ea (diff) | |
download | cpython-dfc2732a57e3ea6603d62f769d4f9c80be726fa4.zip cpython-dfc2732a57e3ea6603d62f769d4f9c80be726fa4.tar.gz cpython-dfc2732a57e3ea6603d62f769d4f9c80be726fa4.tar.bz2 |
gh-91340: Document multiprocessing.set_start_method force parameter (GH-32339)
#91340
https://bugs.python.org/issue47184
Automerge-Triggered-By: GH:kumaraditya303
Diffstat (limited to 'Doc/library/multiprocessing.rst')
-rw-r--r-- | Doc/library/multiprocessing.rst | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index 5516084..b5ceeb7 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -1089,10 +1089,14 @@ Miscellaneous .. versionchanged:: 3.11 Accepts a :term:`path-like object`. -.. function:: set_start_method(method) +.. function:: set_start_method(method, force=False) Set the method which should be used to start child processes. - *method* can be ``'fork'``, ``'spawn'`` or ``'forkserver'``. + The *method* argument can be ``'fork'``, ``'spawn'`` or ``'forkserver'``. + Raises :exc:`RuntimeError` if the start method has already been set and *force* + is not ``True``. If *method* is ``None`` and *force* is ``True`` then the start + method is set to ``None``. If *method* is ``None`` and *force* is ``False`` + then the context is set to the default context. Note that this should be called at most once, and it should be protected inside the ``if __name__ == '__main__'`` clause of the |