@@ -511,6 +511,17 @@ Reference
511511The :mod: `multiprocessing ` package mostly replicates the API of the
512512:mod: `threading ` module.
513513
514+ .. _global-start-method :
515+
516+ Global start method
517+ ^^^^^^^^^^^^^^^^^^^
518+
519+ Calling some functions or methods, or creating some objects, will implicitly
520+ set the global start method to the system's default if it is not already
521+ set. This can only be done once. Therefore, if you need to change the
522+ start method, you must do so before calling these functions or methods, or
523+ creating these objects.
524+
514525
515526:class: `Process ` and exceptions
516527^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -867,9 +878,8 @@ For an example of the usage of queues for interprocess communication see
867878 locks/semaphores. When a process first puts an item on the queue a feeder
868879 thread is started which transfers objects from a buffer into the pipe.
869880
870- If the global start method has not been set, calling this function will
871- have the side effect of setting the current global start method.
872- See the :func: `get_context ` function.
881+ Calling this may set the global start method. See
882+ :ref: `global-start-method ` for more details.
873883
874884 The usual :exc: `queue.Empty ` and :exc: `queue.Full ` exceptions from the
875885 standard library's :mod: `queue ` module are raised to signal timeouts.
@@ -981,9 +991,8 @@ For an example of the usage of queues for interprocess communication see
981991
982992 It is a simplified :class: `Queue ` type, very close to a locked :class: `Pipe `.
983993
984- If the global start method has not been set, calling this function will
985- have the side effect of setting the current global start method.
986- See the :func: `get_context ` function.
994+ Calling this may set the global start method. See
995+ :ref: `global-start-method ` for more details.
987996
988997 .. method :: close()
989998
@@ -1015,9 +1024,8 @@ For an example of the usage of queues for interprocess communication see
10151024 :class: `JoinableQueue `, a :class: `Queue ` subclass, is a queue which
10161025 additionally has :meth: `task_done ` and :meth: `join ` methods.
10171026
1018- If the global start method has not been set, calling this function will
1019- have the side effect of setting the current global start method.
1020- See the :func: `get_context ` function.
1027+ Calling this may set the global start method. See
1028+ :ref: `global-start-method ` for more details.
10211029
10221030 .. method :: task_done()
10231031
@@ -1131,8 +1139,8 @@ Miscellaneous
11311139 :mod: `multiprocessing ` module.
11321140
11331141 If *method * is ``None `` then the default context is returned. Note that if
1134- the global start method has not been set, this will set it to the
1135- default method.
1142+ the global start method has not been set, this will set it.
1143+ See :ref: ` global-start- method` for more details .
11361144 Otherwise *method * should be ``'fork' ``, ``'spawn' ``,
11371145 ``'forkserver' ``. :exc: `ValueError ` is raised if the specified
11381146 start method is not available. See :ref: `multiprocessing-start-methods `.
@@ -1143,10 +1151,9 @@ Miscellaneous
11431151
11441152 Return the name of start method used for starting processes.
11451153
1146- If the global start method has not been set and *allow_none * is
1147- ``False ``, then the start method is set to the default and the name
1148- is returned. If the start method has not been set and *allow_none * is
1149- ``True `` then ``None `` is returned.
1154+ If the start method is not set and *allow_none * is ``False ``, the start
1155+ method is set to the default, and its name is returned. See
1156+ :ref: `global-start-method ` for more details.
11501157
11511158 The return value can be ``'fork' ``, ``'spawn' ``, ``'forkserver' ``
11521159 or ``None ``. See :ref: `multiprocessing-start-methods `.
@@ -1373,9 +1380,8 @@ object -- see :ref:`multiprocessing-managers`.
13731380
13741381 A barrier object: a clone of :class: `threading.Barrier `.
13751382
1376- If the global start method has not been set, calling this function will
1377- have the side effect of setting the current global start method.
1378- See the :func: `get_context ` function.
1383+ Calling this may set the global start method. See
1384+ :ref: `global-start-method ` for more details.
13791385
13801386 .. versionadded :: 3.3
13811387
@@ -1384,9 +1390,8 @@ object -- see :ref:`multiprocessing-managers`.
13841390 A bounded semaphore object: a close analog of
13851391 :class: `threading.BoundedSemaphore `.
13861392
1387- If the global start method has not been set, calling this function will
1388- have the side effect of setting the current global start method.
1389- See the :func: `get_context ` function.
1393+ Calling this may set the global start method. See
1394+ :ref: `global-start-method ` for more details.
13901395
13911396 A solitary difference from its close analog exists: its ``acquire `` method's
13921397 first argument is named *block *, as is consistent with :meth: `Lock.acquire `.
@@ -1408,9 +1413,8 @@ object -- see :ref:`multiprocessing-managers`.
14081413 If *lock * is specified then it should be a :class: `Lock ` or :class: `RLock `
14091414 object from :mod: `multiprocessing `.
14101415
1411- If the global start method has not been set, calling this function will
1412- have the side effect of setting the current global start method.
1413- See the :func: `get_context ` function.
1416+ Calling this may set the global start method. See
1417+ :ref: `global-start-method ` for more details.
14141418
14151419 .. versionchanged :: 3.3
14161420 The :meth: `~threading.Condition.wait_for ` method was added.
@@ -1419,9 +1423,8 @@ object -- see :ref:`multiprocessing-managers`.
14191423
14201424 A clone of :class: `threading.Event `.
14211425
1422- If the global start method has not been set, calling this function will
1423- have the side effect of setting the current global start method.
1424- See the :func: `get_context ` function.
1426+ Calling this may set the global start method. See
1427+ :ref: `global-start-method ` for more details.
14251428
14261429.. class :: Lock()
14271430
@@ -1437,9 +1440,8 @@ object -- see :ref:`multiprocessing-managers`.
14371440 instance of ``multiprocessing.synchronize.Lock `` initialized with a
14381441 default context.
14391442
1440- If the global start method has not been set, calling this function will
1441- have the side effect of setting the current global start method.
1442- See the :func: `get_context ` function.
1443+ Calling this may set the global start method. See
1444+ :ref: `global-start-method ` for more details.
14431445
14441446 :class: `Lock ` supports the :term: `context manager ` protocol and thus may be
14451447 used in :keyword: `with ` statements.
@@ -1498,9 +1500,8 @@ object -- see :ref:`multiprocessing-managers`.
14981500 instance of ``multiprocessing.synchronize.RLock `` initialized with a
14991501 default context.
15001502
1501- If the global start method has not been set, calling this function will
1502- have the side effect of setting the current global start method.
1503- See the :func: `get_context ` function.
1503+ Calling this may set the global start method. See
1504+ :ref: `global-start-method ` for more details.
15041505
15051506 :class: `RLock ` supports the :term: `context manager ` protocol and thus may be
15061507 used in :keyword: `with ` statements.
@@ -1561,9 +1562,8 @@ object -- see :ref:`multiprocessing-managers`.
15611562
15621563 A semaphore object: a close analog of :class: `threading.Semaphore `.
15631564
1564- If the global start method has not been set, calling this function will
1565- have the side effect of setting the current global start method.
1566- See the :func: `get_context ` function.
1565+ Calling this may set the global start method. See
1566+ :ref: `global-start-method ` for more details.
15671567
15681568 A solitary difference from its close analog exists: its ``acquire `` method's
15691569 first argument is named *block *, as is consistent with :meth: `Lock.acquire `.
@@ -1714,9 +1714,8 @@ processes.
17141714 "process-safe".
17151715
17161716 *ctx * is a context object, or ``None `` (use the current context). If ``None ``,
1717- calling this function will have the side effect of setting the current global
1718- start method if it has not been set already. See the :func: `get_context `
1719- function.
1717+ calling this may set the global start method. See
1718+ :ref: `global-start-method ` for more details.
17201719
17211720 Note that *lock * and *ctx * are keyword-only parameters.
17221721
@@ -1734,9 +1733,8 @@ processes.
17341733 "process-safe".
17351734
17361735 *ctx * is a context object, or ``None `` (use the current context). If ``None ``,
1737- calling this function will have the side effect of setting the current global
1738- start method if it has not been set already. See the :func: `get_context `
1739- function.
1736+ calling this may set the global start method. See
1737+ :ref: `global-start-method ` for more details.
17401738
17411739 Note that *lock * and *ctx * are keyword-only parameters.
17421740
@@ -1752,9 +1750,8 @@ processes.
17521750 :class: `multiprocessing.RLock ` object is created automatically.
17531751
17541752 *ctx * is a context object, or ``None `` (use the current context). If ``None ``,
1755- calling this function will have the side effect of setting the current global
1756- start method if it has not been set already. See the :func: `get_context `
1757- function.
1753+ calling this may set the global start method. See
1754+ :ref: `global-start-method ` for more details.
17581755
17591756 A synchronized wrapper will have two methods in addition to those of the
17601757 object it wraps: :meth: `get_obj ` returns the wrapped object and
@@ -1874,9 +1871,8 @@ their parent process exits. The manager classes are defined in the
18741871 ``'xmlrpclib' `` (use :mod: `xmlrpc.client ` serialization).
18751872
18761873 *ctx * is a context object, or ``None `` (use the current context). If ``None ``,
1877- calling this function will have the side effect of setting the current global
1878- start method if it has not been set already. See the :func: `get_context `
1879- function.
1874+ calling this may set the global start method. See
1875+ :ref: `global-start-method ` for more details.
18801876
18811877 *shutdown_timeout * is a timeout in seconds used to wait until the process
18821878 used by the manager completes in the :meth: `shutdown ` method. If the
0 commit comments