Skip to content

Commit 1b7a0ea

Browse files
committed
Update side effect document
1 parent 646225c commit 1b7a0ea

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

Doc/library/multiprocessing.rst

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,10 @@ For an example of the usage of queues for interprocess communication see
867867
locks/semaphores. When a process first puts an item on the queue a feeder
868868
thread is started which transfers objects from a buffer into the pipe.
869869

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.
873+
870874
The usual :exc:`queue.Empty` and :exc:`queue.Full` exceptions from the
871875
standard library's :mod:`queue` module are raised to signal timeouts.
872876

@@ -977,6 +981,10 @@ For an example of the usage of queues for interprocess communication see
977981

978982
It is a simplified :class:`Queue` type, very close to a locked :class:`Pipe`.
979983

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.
987+
980988
.. method:: close()
981989

982990
Close the queue: release internal resources.
@@ -1007,6 +1015,10 @@ For an example of the usage of queues for interprocess communication see
10071015
:class:`JoinableQueue`, a :class:`Queue` subclass, is a queue which
10081016
additionally has :meth:`task_done` and :meth:`join` methods.
10091017

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.
1021+
10101022
.. method:: task_done()
10111023

10121024
Indicate that a formerly enqueued task is complete. Used by queue
@@ -1361,13 +1373,21 @@ object -- see :ref:`multiprocessing-managers`.
13611373

13621374
A barrier object: a clone of :class:`threading.Barrier`.
13631375

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.
1379+
13641380
.. versionadded:: 3.3
13651381

13661382
.. class:: BoundedSemaphore([value])
13671383

13681384
A bounded semaphore object: a close analog of
13691385
:class:`threading.BoundedSemaphore`.
13701386

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.
1390+
13711391
A solitary difference from its close analog exists: its ``acquire`` method's
13721392
first argument is named *block*, as is consistent with :meth:`Lock.acquire`.
13731393

@@ -1388,13 +1408,20 @@ object -- see :ref:`multiprocessing-managers`.
13881408
If *lock* is specified then it should be a :class:`Lock` or :class:`RLock`
13891409
object from :mod:`multiprocessing`.
13901410

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.
1414+
13911415
.. versionchanged:: 3.3
13921416
The :meth:`~threading.Condition.wait_for` method was added.
13931417

13941418
.. class:: Event()
13951419

13961420
A clone of :class:`threading.Event`.
13971421

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.
13981425

13991426
.. class:: Lock()
14001427

@@ -1410,6 +1437,10 @@ object -- see :ref:`multiprocessing-managers`.
14101437
instance of ``multiprocessing.synchronize.Lock`` initialized with a
14111438
default context.
14121439

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+
14131444
:class:`Lock` supports the :term:`context manager` protocol and thus may be
14141445
used in :keyword:`with` statements.
14151446

@@ -1467,6 +1498,10 @@ object -- see :ref:`multiprocessing-managers`.
14671498
instance of ``multiprocessing.synchronize.RLock`` initialized with a
14681499
default context.
14691500

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.
1504+
14701505
:class:`RLock` supports the :term:`context manager` protocol and thus may be
14711506
used in :keyword:`with` statements.
14721507

@@ -1526,6 +1561,10 @@ object -- see :ref:`multiprocessing-managers`.
15261561

15271562
A semaphore object: a close analog of :class:`threading.Semaphore`.
15281563

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.
1567+
15291568
A solitary difference from its close analog exists: its ``acquire`` method's
15301569
first argument is named *block*, as is consistent with :meth:`Lock.acquire`.
15311570

@@ -2330,7 +2369,9 @@ with the :class:`Pool` class.
23302369
the worker processes. Usually a pool is created using the
23312370
function :func:`multiprocessing.Pool` or the :meth:`Pool` method
23322371
of a context object. In both cases *context* is set
2333-
appropriately.
2372+
appropriately. If ``None``, calling this function will have the side effect
2373+
of setting the current global start method if it has not been set already.
2374+
See the :func:`get_context` function.
23342375

23352376
Note that the methods of the pool object should only be called by
23362377
the process which created the pool.

0 commit comments

Comments
 (0)