You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Doc/library/multiprocessing.rst
+26-8Lines changed: 26 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1049,25 +1049,43 @@ Miscellaneous
1049
1049
1050
1050
.. function:: get_context(method=None)
1051
1051
1052
-
Return a context object with the same attributes as the :mod:`multiprocessing` module.
1052
+
Return a context object with the same attributes as the
1053
+
:mod:`multiprocessing` module.
1053
1054
1054
-
If *method* is ``None``, the default context is returned. Be aware that calling this function with *method=None* sets the default context globally, potentially affecting future usage of :func:`set_start_method`. To change the method later, it is recommended to explicitly specify a method other than ``None`` when calling this function. Otherwise, it may lead to unexpected behavior.
1055
+
If *method* is ``None``, the default context is returned. Be aware that
1056
+
calling this function with *method=None* sets the default context globally,
1057
+
potentially affecting future usage of :func:`set_start_method`. To change
1058
+
the method later, it is recommended to explicitly specify a method other
1059
+
than ``None`` when calling this function. Otherwise, it may lead to
1060
+
unexpected behavior.
1055
1061
1056
-
*method* should be one of the following: ``'fork'``, ``'spawn'``, or ``'forkserver'``. A :exc:`ValueError` is raised if the specified start method is unavailable. See :ref:`multiprocessing-start-methods`.
1062
+
*method* should be one of the following: ``'fork'``, ``'spawn'``, or
1063
+
``'forkserver'``. A :exc:`ValueError` is raised if the specified start
1064
+
method is unavailable. See :ref:`multiprocessing-start-methods`.
1057
1065
1058
1066
.. versionadded:: 3.4
1059
1067
1060
1068
.. function:: get_start_method(allow_none=False)
1061
1069
1062
-
Return the name of the start method used for initiating processes.
1070
+
Return the name of start method used for starting processes.
1063
1071
1064
-
If the start method has not been explicitly set (e.g., using :func:`set_start_method`) and *allow_none* is false, then the start method is fixed to the default, and the name of the default method is returned. If the start method has not been explicitly set and *allow_none* is true, then ``None`` is returned, indicating that the method has not been explicitly set.
1072
+
If the start method has not been explicitly set
1073
+
(e.g., using :func:`set_start_method`) and *allow_none* is false, then the
1074
+
start method is fixed to the default, and the name of the default method
1075
+
is returned. If the start method has not been explicitly set and
1076
+
*allow_none* is true, then ``None`` is returned, indicating that
1077
+
the method has not been explicitly set.
1065
1078
1066
-
The return value can be one of the following: ``'fork'``, ``'spawn'``, ``'forkserver'``, or ``None``.
1079
+
The return value can be one of the following: ``'fork'``, ``'spawn'``,
1080
+
``'forkserver'``, or ``None``.
1067
1081
1068
-
.. note:: Exercise caution when changing the start method using ``multiprocessing.set_start_method`` after using ``multiprocessing.get_start_method`` with *allow_none* set to ``False``, as it may raise a ``RuntimeError``.
1082
+
.. note:: Exercise caution when changing the start method using
1083
+
``multiprocessing.set_start_method`` after using
1084
+
``multiprocessing.get_start_method`` with *allow_none* set to
1085
+
``False``, as it may raise a ``RuntimeError``.
1069
1086
1070
-
See :ref:`multiprocessing-start-methods` for more information on multiprocessing start methods and their implications.
1087
+
See :ref:`multiprocessing-start-methods` for more information
1088
+
on multiprocessing start methods and their implications.
0 commit comments