@@ -56,7 +56,7 @@ will print to standard output ::
56
56
57
57
58
58
The :class: `Process ` class
59
- ~~~~~~~~~~~~~~~~~~~~~~~~~~
59
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^
60
60
61
61
In :mod: `multiprocessing `, processes are spawned by creating a :class: `Process `
62
62
object and then calling its :meth: `~Process.start ` method. :class: `Process `
@@ -102,7 +102,7 @@ necessary, see :ref:`multiprocessing-programming`.
102
102
.. _multiprocessing-start-methods :
103
103
104
104
Contexts and start methods
105
- ~~~~~~~~~~~~~~~~~~~~~~~~~~
105
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^
106
106
107
107
Depending on the platform, :mod: `multiprocessing ` supports three ways
108
108
to start a process. These *start methods * are
@@ -231,7 +231,7 @@ library user.
231
231
232
232
233
233
Exchanging objects between processes
234
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
234
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
235
235
236
236
:mod: `multiprocessing ` supports two types of communication channel between
237
237
processes:
@@ -283,7 +283,7 @@ processes:
283
283
284
284
285
285
Synchronization between processes
286
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
286
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
287
287
288
288
:mod: `multiprocessing ` contains equivalents of all the synchronization
289
289
primitives from :mod: `threading `. For instance one can use a lock to ensure
@@ -309,7 +309,7 @@ mixed up.
309
309
310
310
311
311
Sharing state between processes
312
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
312
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
313
313
314
314
As mentioned above, when doing concurrent programming it is usually best to
315
315
avoid using shared state as far as possible. This is particularly true when
@@ -399,7 +399,7 @@ However, if you really do need to use some shared data then
399
399
400
400
401
401
Using a pool of workers
402
- ~~~~~~~~~~~~~~~~~~~~~~~
402
+ ^^^^^^^^^^^^^^^^^^^^^^^
403
403
404
404
The :class: `~multiprocessing.pool.Pool ` class represents a pool of worker
405
405
processes. It has methods which allows tasks to be offloaded to the worker
@@ -490,7 +490,7 @@ The :mod:`multiprocessing` package mostly replicates the API of the
490
490
491
491
492
492
:class: `Process ` and exceptions
493
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
493
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
494
494
495
495
.. class :: Process(group=None, target=None, name=None, args=(), kwargs={}, \
496
496
*, daemon=None)
@@ -724,7 +724,7 @@ The :mod:`multiprocessing` package mostly replicates the API of the
724
724
Raised by methods with a timeout when the timeout expires.
725
725
726
726
Pipes and Queues
727
- ~~~~~~~~~~~~~~~~
727
+ ^^^^^^^^^^^^^^^^
728
728
729
729
When using multiple processes, one generally uses message passing for
730
730
communication between processes and avoids having to use any synchronization
@@ -981,7 +981,7 @@ For an example of the usage of queues for interprocess communication see
981
981
982
982
983
983
Miscellaneous
984
- ~~~~~~~~~~~~~
984
+ ^^^^^^^^^^^^^
985
985
986
986
.. function :: active_children()
987
987
@@ -1150,7 +1150,7 @@ Miscellaneous
1150
1150
1151
1151
1152
1152
Connection Objects
1153
- ~~~~~~~~~~~~~~~~~~
1153
+ ^^^^^^^^^^^^^^^^^^
1154
1154
1155
1155
.. currentmodule :: multiprocessing.connection
1156
1156
@@ -1292,7 +1292,7 @@ For example:
1292
1292
1293
1293
1294
1294
Synchronization primitives
1295
- ~~~~~~~~~~~~~~~~~~~~~~~~~~
1295
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^
1296
1296
1297
1297
.. currentmodule :: multiprocessing
1298
1298
@@ -1481,7 +1481,7 @@ object -- see :ref:`multiprocessing-managers`.
1481
1481
1482
1482
1483
1483
Shared :mod: `ctypes ` Objects
1484
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1484
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1485
1485
1486
1486
It is possible to create shared objects using shared memory which can be
1487
1487
inherited by child processes.
@@ -1543,7 +1543,7 @@ inherited by child processes.
1543
1543
1544
1544
1545
1545
The :mod: `multiprocessing.sharedctypes ` module
1546
- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1546
+ """"""""""""""""""""""""""""""""""""""""""""""
1547
1547
1548
1548
.. module :: multiprocessing.sharedctypes
1549
1549
:synopsis: Allocate ctypes objects from shared memory.
@@ -1709,7 +1709,7 @@ The results printed are ::
1709
1709
.. _multiprocessing-managers :
1710
1710
1711
1711
Managers
1712
- ~~~~~~~~
1712
+ ^^^^^^^^
1713
1713
1714
1714
Managers provide a way to create data which can be shared between different
1715
1715
processes, including sharing over a network between processes running on
@@ -1954,7 +1954,7 @@ their parent process exits. The manager classes are defined in the
1954
1954
1955
1955
1956
1956
Customized managers
1957
- >>>>>>>>>>>>>>>>>>>
1957
+ """""""""""""""""""
1958
1958
1959
1959
To create one's own manager, one creates a subclass of :class: `BaseManager ` and
1960
1960
uses the :meth: `~BaseManager.register ` classmethod to register new types or
@@ -1981,7 +1981,7 @@ callables with the manager class. For example::
1981
1981
1982
1982
1983
1983
Using a remote manager
1984
- >>>>>>>>>>>>>>>>>>>>>>
1984
+ """"""""""""""""""""""
1985
1985
1986
1986
It is possible to run a manager server on one machine and have clients use it
1987
1987
from other machines (assuming that the firewalls involved allow it).
@@ -2044,7 +2044,7 @@ client to access it remotely::
2044
2044
.. _multiprocessing-proxy_objects :
2045
2045
2046
2046
Proxy Objects
2047
- ~~~~~~~~~~~~~
2047
+ ^^^^^^^^^^^^^
2048
2048
2049
2049
A proxy is an object which *refers * to a shared object which lives (presumably)
2050
2050
in a different process. The shared object is said to be the *referent * of the
@@ -2196,7 +2196,7 @@ demonstrates a level of control over the synchronization.
2196
2196
2197
2197
2198
2198
Cleanup
2199
- >>>>>>>
2199
+ """""""
2200
2200
2201
2201
A proxy object uses a weakref callback so that when it gets garbage collected it
2202
2202
deregisters itself from the manager which owns its referent.
@@ -2206,7 +2206,7 @@ any proxies referring to it.
2206
2206
2207
2207
2208
2208
Process Pools
2209
- ~~~~~~~~~~~~~
2209
+ ^^^^^^^^^^^^^
2210
2210
2211
2211
.. module :: multiprocessing.pool
2212
2212
:synopsis: Create pools of processes.
@@ -2442,7 +2442,7 @@ The following example demonstrates the use of a pool::
2442
2442
.. _multiprocessing-listeners-clients :
2443
2443
2444
2444
Listeners and Clients
2445
- ~~~~~~~~~~~~~~~~~~~~~
2445
+ ^^^^^^^^^^^^^^^^^^^^^
2446
2446
2447
2447
.. module :: multiprocessing.connection
2448
2448
:synopsis: API for dealing with sockets.
@@ -2665,7 +2665,7 @@ wait for messages from multiple processes at once::
2665
2665
.. _multiprocessing-address-formats :
2666
2666
2667
2667
Address Formats
2668
- >>>>>>>>>>>>>>>
2668
+ """""""""""""""
2669
2669
2670
2670
* An ``'AF_INET' `` address is a tuple of the form ``(hostname, port) `` where
2671
2671
*hostname * is a string and *port * is an integer.
@@ -2685,7 +2685,7 @@ an ``'AF_PIPE'`` address rather than an ``'AF_UNIX'`` address.
2685
2685
.. _multiprocessing-auth-keys :
2686
2686
2687
2687
Authentication keys
2688
- ~~~~~~~~~~~~~~~~~~~
2688
+ ^^^^^^^^^^^^^^^^^^^
2689
2689
2690
2690
When one uses :meth: `Connection.recv <Connection.recv> `, the
2691
2691
data received is automatically
@@ -2711,7 +2711,7 @@ Suitable authentication keys can also be generated by using :func:`os.urandom`.
2711
2711
2712
2712
2713
2713
Logging
2714
- ~~~~~~~
2714
+ ^^^^^^^
2715
2715
2716
2716
Some support for logging is available. Note, however, that the :mod: `logging `
2717
2717
package does not use process shared locks so it is possible (depending on the
@@ -2759,7 +2759,7 @@ For a full table of logging levels, see the :mod:`logging` module.
2759
2759
2760
2760
2761
2761
The :mod: `multiprocessing.dummy ` module
2762
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2762
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2763
2763
2764
2764
.. module :: multiprocessing.dummy
2765
2765
:synopsis: Dumb wrapper around threading.
@@ -2818,7 +2818,7 @@ There are certain guidelines and idioms which should be adhered to when using
2818
2818
2819
2819
2820
2820
All start methods
2821
- ~~~~~~~~~~~~~~~~~
2821
+ ^^^^^^^^^^^^^^^^^
2822
2822
2823
2823
The following applies to all start methods.
2824
2824
@@ -2977,7 +2977,7 @@ Beware of replacing :data:`sys.stdin` with a "file like object"
2977
2977
For more information, see :issue: `5155 `, :issue: `5313 ` and :issue: `5331 `
2978
2978
2979
2979
The *spawn * and *forkserver * start methods
2980
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2980
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2981
2981
2982
2982
There are a few extra restriction which don't apply to the *fork *
2983
2983
start method.
0 commit comments