Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/library/multiprocessing.rst

    r2 r391  
    2929.. note::
    3030
    31     Functionality within this package requires that the ``__main__`` method be
     31    Functionality within this package requires that the ``__main__`` module be
    3232    importable by the children. This is covered in :ref:`multiprocessing-programming`
    3333    however it is worth pointing out here. This means that some examples, such
     
    8282        print title
    8383        print 'module name:', __name__
    84         print 'parent process:', os.getppid()
     84        if hasattr(os, 'getppid'):  # only available on Unix
     85            print 'parent process:', os.getppid()
    8586        print 'process id:', os.getpid()
    8687
     
    108109**Queues**
    109110
    110    The :class:`Queue` class is a near clone of :class:`Queue.Queue`.  For
     111   The :class:`~multiprocessing.Queue` class is a near clone of :class:`Queue.Queue`.  For
    111112   example::
    112113
     
    217218   typecodes of the kind used by the :mod:`array` module: ``'d'`` indicates a
    218219   double precision float and ``'i'`` indicates a signed integer.  These shared
    219    objects will be process and thread safe.
     220   objects will be process and thread-safe.
    220221
    221222   For more flexibility in using shared memory one can use the
     
    232233   :class:`dict`, :class:`Namespace`, :class:`Lock`, :class:`RLock`,
    233234   :class:`Semaphore`, :class:`BoundedSemaphore`, :class:`Condition`,
    234    :class:`Event`, :class:`Queue`, :class:`Value` and :class:`Array`.  For
     235   :class:`Event`, :class:`~multiprocessing.Queue`, :class:`Value` and :class:`Array`.  For
    235236   example, ::
    236237
     
    283284   if __name__ == '__main__':
    284285       pool = Pool(processes=4)              # start 4 worker processes
    285        result = pool.apply_async(f, [10])     # evaluate "f(10)" asynchronously
     286       result = pool.apply_async(f, [10])    # evaluate "f(10)" asynchronously
    286287       print result.get(timeout=1)           # prints "100" unless your computer is *very* slow
    287288       print pool.map(f, range(10))          # prints "[0, 1, 4,..., 81]"
    288289
     290Note that the methods of a pool should only ever be used by the
     291process which created it.
     292
    289293
    290294Reference
     
    298302~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    299303
    300 .. class:: Process([group[, target[, name[, args[, kwargs]]]]])
     304.. class:: Process(group=None, target=None, name=None, args=(), kwargs={})
    301305
    302306   Process objects represent activity that is run in a separate process. The
     
    377381      terminated when its parent process exits. Additionally, these are **not**
    378382      Unix daemons or services, they are normal processes that will be
    379       terminated (and not joined) if non-dameonic processes have exited.
    380 
    381    In addition to the  :class:`Threading.Thread` API, :class:`Process` objects
     383      terminated (and not joined) if non-daemonic processes have exited.
     384
     385   In addition to the  :class:`threading.Thread` API, :class:`Process` objects
    382386   also support the following attributes and methods:
    383387
     
    398402
    399403      When :mod:`multiprocessing` is initialized the main process is assigned a
    400       random string using :func:`os.random`.
     404      random string using :func:`os.urandom`.
    401405
    402406      When a :class:`Process` object is created, it will inherit the
     
    409413
    410414      Terminate the process.  On Unix this is done using the ``SIGTERM`` signal;
    411       on Windows :cfunc:`TerminateProcess` is used.  Note that exit handlers and
     415      on Windows :c:func:`TerminateProcess` is used.  Note that exit handlers and
    412416      finally clauses, etc., will not be executed.
    413417
     
    423427         cause other processes to deadlock.
    424428
    425    Note that the :meth:`start`, :meth:`join`, :meth:`is_alive` and
    426    :attr:`exit_code` methods should only be called by the process that created
    427    the process object.
     429   Note that the :meth:`start`, :meth:`join`, :meth:`is_alive`,
     430   :meth:`terminate` and :attr:`exitcode` methods should only be called by
     431   the process that created the process object.
    428432
    429433   Example usage of some of the methods of :class:`Process`:
     
    465469processes) or a queue (which allows multiple producers and consumers).
    466470
    467 The :class:`Queue` and :class:`JoinableQueue` types are multi-producer,
     471The :class:`~multiprocessing.Queue`, :class:`multiprocessing.queues.SimpleQueue` and :class:`JoinableQueue` types are multi-producer,
    468472multi-consumer FIFO queues modelled on the :class:`Queue.Queue` class in the
    469 standard library.  They differ in that :class:`Queue` lacks the
     473standard library.  They differ in that :class:`~multiprocessing.Queue` lacks the
    470474:meth:`~Queue.Queue.task_done` and :meth:`~Queue.Queue.join` methods introduced
    471475into Python 2.5's :class:`Queue.Queue` class.
     
    473477If you use :class:`JoinableQueue` then you **must** call
    474478:meth:`JoinableQueue.task_done` for each task removed from the queue or else the
    475 semaphore used to count the number of unfinished tasks may eventually overflow
     479semaphore used to count the number of unfinished tasks may eventually overflow,
    476480raising an exception.
    477481
     
    486490   :mod:`Queue`.
    487491
     492.. note::
     493
     494   When an object is put on a queue, the object is pickled and a
     495   background thread later flushes the pickled data to an underlying
     496   pipe.  This has some consequences which are a little surprising,
     497   but should not cause any practical difficulties -- if they really
     498   bother you then you can instead use a queue created with a
     499   :ref:`manager <multiprocessing-managers>`.
     500
     501   (1) After putting an object on an empty queue there may be an
     502       infinitesimal delay before the queue's :meth:`~Queue.empty`
     503       method returns :const:`False` and :meth:`~Queue.get_nowait` can
     504       return without raising :exc:`Queue.Empty`.
     505
     506   (2) If multiple processes are enqueuing objects, it is possible for
     507       the objects to be received at the other end out-of-order.
     508       However, objects enqueued by the same process will always be in
     509       the expected order with respect to each other.
    488510
    489511.. warning::
    490512
    491513   If a process is killed using :meth:`Process.terminate` or :func:`os.kill`
    492    while it is trying to use a :class:`Queue`, then the data in the queue is
    493    likely to become corrupted.  This may cause any other processes to get an
     514   while it is trying to use a :class:`~multiprocessing.Queue`, then the data in the queue is
     515   likely to become corrupted.  This may cause any other process to get an
    494516   exception when it tries to use the queue later on.
    495517
     
    497519
    498520   As mentioned above, if a child process has put items on a queue (and it has
    499    not used :meth:`JoinableQueue.cancel_join_thread`), then that process will
     521   not used :meth:`JoinableQueue.cancel_join_thread
     522   <multiprocessing.Queue.cancel_join_thread>`), then that process will
    500523   not terminate until all buffered items have been flushed to the pipe.
    501524
     
    532555   standard library's :mod:`Queue` module are raised to signal timeouts.
    533556
    534    :class:`Queue` implements all the methods of :class:`Queue.Queue` except for
     557   :class:`~multiprocessing.Queue` implements all the methods of :class:`Queue.Queue` except for
    535558   :meth:`~Queue.Queue.task_done` and :meth:`~Queue.Queue.join`.
    536559
     
    553576      multithreading/multiprocessing semantics, this is not reliable.
    554577
    555    .. method:: put(item[, block[, timeout]])
    556 
    557       Put item into the queue.  If the optional argument *block* is ``True``
     578   .. method:: put(obj[, block[, timeout]])
     579
     580      Put obj into the queue.  If the optional argument *block* is ``True``
    558581      (the default) and *timeout* is ``None`` (the default), block if necessary until
    559582      a free slot is available.  If *timeout* is a positive number, it blocks at
     
    564587      ignored in that case).
    565588
    566    .. method:: put_nowait(item)
    567 
    568       Equivalent to ``put(item, False)``.
     589   .. method:: put_nowait(obj)
     590
     591      Equivalent to ``put(obj, False)``.
    569592
    570593   .. method:: get([block[, timeout]])
     
    579602
    580603   .. method:: get_nowait()
    581                get_no_wait()
    582604
    583605      Equivalent to ``get(False)``.
    584606
    585    :class:`multiprocessing.Queue` has a few additional methods not found in
     607   :class:`~multiprocessing.Queue` has a few additional methods not found in
    586608   :class:`Queue.Queue`.  These methods are usually unnecessary for most
    587609   code:
     
    610632      exits -- see :meth:`join_thread`.
    611633
     634      A better name for this method might be
     635      ``allow_exit_without_flush()``.  It is likely to cause enqueued
     636      data to lost, and you almost certainly will not need to use it.
     637      It is really only there if you need the current process to exit
     638      immediately without waiting to flush enqueued data to the
     639      underlying pipe, and you don't care about lost data.
     640
     641
     642.. class:: multiprocessing.queues.SimpleQueue()
     643
     644   It is a simplified :class:`~multiprocessing.Queue` type, very close to a locked :class:`Pipe`.
     645
     646   .. method:: empty()
     647
     648      Return ``True`` if the queue is empty, ``False`` otherwise.
     649
     650   .. method:: get()
     651
     652      Remove and return an item from the queue.
     653
     654   .. method:: put(item)
     655
     656      Put *item* into the queue.
     657
    612658
    613659.. class:: JoinableQueue([maxsize])
    614660
    615    :class:`JoinableQueue`, a :class:`Queue` subclass, is a queue which
     661   :class:`JoinableQueue`, a :class:`~multiprocessing.Queue` subclass, is a queue which
    616662   additionally has :meth:`task_done` and :meth:`join` methods.
    617663
     
    623669      is complete.
    624670
    625       If a :meth:`~Queue.join` is currently blocking, it will resume when all
     671      If a :meth:`~Queue.Queue.join` is currently blocking, it will resume when all
    626672      items have been processed (meaning that a :meth:`task_done` call was
    627673      received for every item that had been :meth:`~Queue.put` into the queue).
     
    639685      :meth:`task_done` to indicate that the item was retrieved and all work on
    640686      it is complete.  When the count of unfinished tasks drops to zero,
    641       :meth:`~Queue.join` unblocks.
     687      :meth:`~Queue.Queue.join` unblocks.
    642688
    643689
     
    693739   do some thing like ::
    694740
    695       setExecutable(os.path.join(sys.exec_prefix, 'pythonw.exe'))
     741      set_executable(os.path.join(sys.exec_prefix, 'pythonw.exe'))
    696742
    697743   before they can create child processes.  (Windows only)
     
    712758strings.  They can be thought of as message oriented connected sockets.
    713759
    714 Connection objects usually created using :func:`Pipe` -- see also
     760Connection objects are usually created using :func:`Pipe` -- see also
    715761:ref:`multiprocessing-listeners-clients`.
    716762
     
    722768      using :meth:`recv`.
    723769
    724       The object must be picklable.
     770      The object must be picklable.  Very large pickles (approximately 32 MB+,
     771      though it depends on the OS) may raise a :exc:`ValueError` exception.
    725772
    726773   .. method:: recv()
    727774
    728775      Return an object sent from the other end of the connection using
    729       :meth:`send`.  Raises :exc:`EOFError` if there is nothing left to receive
     776      :meth:`send`.  Blocks until there its something to receive.  Raises
     777      :exc:`EOFError` if there is nothing left to receive
    730778      and the other end was closed.
    731779
    732780   .. method:: fileno()
    733781
    734       Returns the file descriptor or handle used by the connection.
     782      Return the file descriptor or handle used by the connection.
    735783
    736784   .. method:: close()
     
    754802
    755803      If *offset* is given then data is read from that position in *buffer*.  If
    756       *size* is given then that many bytes will be read from buffer.
     804      *size* is given then that many bytes will be read from buffer.  Very large
     805      buffers (approximately 32 MB+, though it depends on the OS) may raise a
     806      :exc:`ValueError` exception
    757807
    758808   .. method:: recv_bytes([maxlength])
    759809
    760810      Return a complete message of byte data sent from the other end of the
    761       connection as a string.  Raises :exc:`EOFError` if there is nothing left
     811      connection as a string.  Blocks until there is something to receive.
     812      Raises :exc:`EOFError` if there is nothing left
    762813      to receive and the other end has closed.
    763814
     
    769820
    770821      Read into *buffer* a complete message of byte data sent from the other end
    771       of the connection and return the number of bytes in the message.  Raises
     822      of the connection and return the number of bytes in the message.  Blocks
     823      until there is something to receive.  Raises
    772824      :exc:`EOFError` if there is nothing left to receive and the other end was
    773825      closed.
     
    837889   A bounded semaphore object: a clone of :class:`threading.BoundedSemaphore`.
    838890
    839    (On Mac OS X this is indistinguishable from :class:`Semaphore` because
     891   (On Mac OS X, this is indistinguishable from :class:`Semaphore` because
    840892   ``sem_getvalue()`` is not implemented on that platform).
    841893
     
    850902
    851903   A clone of :class:`threading.Event`.
     904   This method returns the state of the internal semaphore on exit, so it
     905   will always return ``True`` except if a timeout is given and the operation
     906   times out.
     907
     908   .. versionchanged:: 2.7
     909      Previously, the method always returned ``None``.
    852910
    853911.. class:: Lock()
     
    861919.. class:: Semaphore([value])
    862920
    863    A bounded semaphore object: a clone of :class:`threading.Semaphore`.
     921   A semaphore object: a clone of :class:`threading.Semaphore`.
    864922
    865923.. note::
     
    873931   ignored.
    874932
    875 .. note::
    876    On OS/X ``sem_timedwait`` is unsupported, so timeout arguments for the
    877    aforementioned :meth:`acquire` methods will be ignored on OS/X.
     933   On Mac OS X, ``sem_timedwait`` is unsupported, so calling ``acquire()`` with
     934   a timeout will emulate that function's behavior using a sleeping loop.
    878935
    879936.. note::
     
    9941051
    9951052   If *lock* is ``True`` (the default) then a new lock object is created to
    996    synchronize access to the value.  If *lock* is a :class:`Lock` or
    997    :class:`RLock` object then that will be used to synchronize access to the
     1053   synchronize access to the value.  If *lock* is a
     1054   :class:`~multiprocessing.Lock` or :class:`~multiprocessing.RLock` object
     1055   then that will be used to synchronize access to the
    9981056   value.  If *lock* is ``False`` then access to the returned object will not be
    9991057   automatically protected by a lock, so it will not necessarily be
     
    10091067
    10101068   If *lock* is ``True`` (the default) then a new lock object is created to
    1011    synchronize access to the value.  If *lock* is a :class:`Lock` or
    1012    :class:`RLock` object then that will be used to synchronize access to the
     1069   synchronize access to the value.  If *lock* is a :class:`~multiprocessing.Lock` or
     1070   :class:`~multiprocessing.RLock` object then that will be used to synchronize access to the
    10131071   value.  If *lock* is ``False`` then access to the returned object will not be
    10141072   automatically protected by a lock, so it will not necessarily be
     
    11251183   Create a BaseManager object.
    11261184
    1127    Once created one should call :meth:`start` or :meth:`serve_forever` to ensure
     1185   Once created one should call :meth:`start` or ``get_server().serve_forever()`` to ensure
    11281186   that the manager object refers to a started manager process.
    11291187
     
    11361194   must be a string.
    11371195
    1138    .. method:: start()
    1139 
    1140       Start a subprocess to start the manager.
    1141 
    1142    .. method:: serve_forever()
    1143 
    1144       Run the server in the current process.
     1196   .. method:: start([initializer[, initargs]])
     1197
     1198      Start a subprocess to start the manager.  If *initializer* is not ``None``
     1199      then the subprocess will call ``initializer(*initargs)`` when it starts.
    11451200
    11461201   .. method:: get_server()
     
    11951250      where no exposed list is specified, all "public methods" of the shared
    11961251      object will be accessible.  (Here a "public method" means any attribute
    1197       which has a :meth:`__call__` method and whose name does not begin with
    1198       ``'_'``.)
     1252      which has a :meth:`~object.__call__` method and whose name does not begin
     1253      with ``'_'``.)
    11991254
    12001255      *method_to_typeid* is a mapping used to specify the return type of those
     
    12811336
    12821337      Create a shared ``list`` object and return a proxy for it.
     1338
     1339   .. note::
     1340
     1341      Modifications to mutable values or items in dict and list proxies will not
     1342      be propagated through the manager, because the proxy has no way of knowing
     1343      when its values or items are modified.  To modify such an item, you can
     1344      re-assign the modified object to the container proxy::
     1345
     1346         # create a list proxy and append a mutable object (a dictionary)
     1347         lproxy = manager.list()
     1348         lproxy.append({})
     1349         # now mutate the dictionary
     1350         d = lproxy[0]
     1351         d['a'] = 1
     1352         d['b'] = 2
     1353         # at this point, the changes to d are not yet synced, but by
     1354         # reassigning the dictionary, the proxy is notified of the change
     1355         lproxy[0] = d
    12831356
    12841357
     
    13071380
    13081381To create one's own manager, one creates a subclass of :class:`BaseManager` and
    1309 use the :meth:`~BaseManager.register` classmethod to register new types or
     1382uses the :meth:`~BaseManager.register` classmethod to register new types or
    13101383callables with the manager class.  For example::
    13111384
     
    14721545      argument of :meth:`BaseManager.register`.
    14731546
    1474       If an exception is raised by the call, then then is re-raised by
     1547      If an exception is raised by the call, then is re-raised by
    14751548      :meth:`_callmethod`.  If some other exception is raised in the manager's
    14761549      process then this is converted into a :exc:`RemoteError` exception and is
     
    15281601with the :class:`Pool` class.
    15291602
    1530 .. class:: multiprocessing.Pool([processes[, initializer[, initargs]]])
     1603.. class:: multiprocessing.Pool([processes[, initializer[, initargs[, maxtasksperchild]]]])
    15311604
    15321605   A process pool object which controls a pool of worker processes to which jobs
     
    15391612   ``initializer(*initargs)`` when it starts.
    15401613
     1614   Note that the methods of the pool object should only be called by
     1615   the process which created the pool.
     1616
     1617   .. versionadded:: 2.7
     1618      *maxtasksperchild* is the number of tasks a worker process can complete
     1619      before it will exit and be replaced with a fresh worker process, to enable
     1620      unused resources to be freed. The default *maxtasksperchild* is None, which
     1621      means worker processes will live as long as the pool.
     1622
     1623   .. note::
     1624
     1625      Worker processes within a :class:`Pool` typically live for the complete
     1626      duration of the Pool's work queue. A frequent pattern found in other
     1627      systems (such as Apache, mod_wsgi, etc) to free resources held by
     1628      workers is to allow a worker within a pool to complete only a set
     1629      amount of work before being exiting, being cleaned up and a new
     1630      process spawned to replace the old one. The *maxtasksperchild*
     1631      argument to the :class:`Pool` exposes this ability to the end user.
     1632
    15411633   .. method:: apply(func[, args[, kwds]])
    15421634
    1543       Equivalent of the :func:`apply` built-in function.  It blocks till the
    1544       result is ready.  Given this blocks, :meth:`apply_async` is better suited
    1545       for performing work in parallel. Additionally, the passed
    1546       in function is only executed in one of the workers of the pool.
     1635      Equivalent of the :func:`apply` built-in function.  It blocks until the
     1636      result is ready, so :meth:`apply_async` is better suited for performing
     1637      work in parallel. Additionally, *func* is only executed in one of the
     1638      workers of the pool.
    15471639
    15481640   .. method:: apply_async(func[, args[, kwds[, callback]]])
     
    15581650
    15591651      A parallel equivalent of the :func:`map` built-in function (it supports only
    1560       one *iterable* argument though).  It blocks till the result is ready.
     1652      one *iterable* argument though).  It blocks until the result is ready.
    15611653
    15621654      This method chops the iterable into a number of chunks which it submits to
     
    15791671      The *chunksize* argument is the same as the one used by the :meth:`.map`
    15801672      method.  For very long iterables using a large value for *chunksize* can
    1581       make make the job complete **much** faster than using the default value of
     1673      make the job complete **much** faster than using the default value of
    15821674      ``1``.
    15831675
     
    16691761
    16701762Usually message passing between processes is done using queues or by using
    1671 :class:`Connection` objects returned by :func:`Pipe`.
     1763:class:`~multiprocessing.Connection` objects returned by
     1764:func:`~multiprocessing.Pipe`.
    16721765
    16731766However, the :mod:`multiprocessing.connection` module allows some extra
     
    16861779   :exc:`AuthenticationError` is raised.
    16871780
    1688 .. function:: answerChallenge(connection, authkey)
     1781.. function:: answer_challenge(connection, authkey)
    16891782
    16901783   Receive a message, calculate the digest of the message using *authkey* as the
     
    17351828
    17361829   If the listener object uses a socket then *backlog* (1 by default) is passed
    1737    to the :meth:`listen` method of the socket once it has been bound.
     1830   to the :meth:`~socket.socket.listen` method of the socket once it has been
     1831   bound.
    17381832
    17391833   If *authenticate* is ``True`` (``False`` by default) or *authkey* is not
     
    17521846
    17531847      Accept a connection on the bound socket or named pipe of the listener
    1754       object and return a :class:`Connection` object.  If authentication is
    1755       attempted and fails, then :exc:`AuthenticationError` is raised.
     1848      object and return a :class:`~multiprocessing.Connection` object.  If
     1849      authentication is attempted and fails, then
     1850      :exc:`~multiprocessing.AuthenticationError` is raised.
    17561851
    17571852   .. method:: close()
     
    18491944~~~~~~~~~~~~~~~~~~~
    18501945
    1851 When one uses :meth:`Connection.recv`, the data received is automatically
     1946When one uses :meth:`Connection.recv <multiprocessing.Connection.recv>`, the
     1947data received is automatically
    18521948unpickled.  Unfortunately unpickling data from an untrusted source is a security
    18531949risk.  Therefore :class:`Listener` and :func:`Client` use the :mod:`hmac` module
     
    19982094    On Unix when a process finishes but has not been joined it becomes a zombie.
    19992095    There should never be very many because each time a new process starts (or
    2000     :func:`active_children` is called) all completed processes which have not
    2001     yet been joined will be joined.  Also calling a finished process's
    2002     :meth:`Process.is_alive` will join the process.  Even so it is probably good
     2096    :func:`~multiprocessing.active_children` is called) all completed processes
     2097    which have not yet been joined will be joined.  Also calling a finished
     2098    process's :meth:`Process.is_alive <multiprocessing.Process.is_alive>` will
     2099    join the process.  Even so it is probably good
    20032100    practice to explicitly join all the processes that you start.
    20042101
     
    20082105    that child processes can use them.  However, one should generally avoid
    20092106    sending shared objects to other processes using pipes or queues.  Instead
    2010     you should arrange the program so that a process which need access to a
     2107    you should arrange the program so that a process which needs access to a
    20112108    shared resource created elsewhere can inherit it from an ancestor process.
    20122109
    20132110Avoid terminating processes
    20142111
    2015     Using the :meth:`Process.terminate` method to stop a process is liable to
     2112    Using the :meth:`Process.terminate <multiprocessing.Process.terminate>`
     2113    method to stop a process is liable to
    20162114    cause any shared resources (such as locks, semaphores, pipes and queues)
    20172115    currently being used by the process to become broken or unavailable to other
     
    20192117
    20202118    Therefore it is probably best to only consider using
    2021     :meth:`Process.terminate` on processes which never use any shared resources.
     2119    :meth:`Process.terminate <multiprocessing.Process.terminate>` on processes
     2120    which never use any shared resources.
    20222121
    20232122Joining processes that use queues
     
    20262125    terminating until all the buffered items are fed by the "feeder" thread to
    20272126    the underlying pipe.  (The child process can call the
    2028     :meth:`Queue.cancel_join_thread` method of the queue to avoid this behaviour.)
     2127    :meth:`~multiprocessing.Queue.cancel_join_thread` method of the queue to avoid this behaviour.)
    20292128
    20302129    This means that whenever you use a queue you need to make sure that all
     
    20872186                Process(target=f, args=(lock,)).start()
    20882187
    2089 Beware replacing sys.stdin with a "file like object"
     2188Beware of replacing :data:`sys.stdin` with a "file like object"
    20902189
    20912190    :mod:`multiprocessing` originally unconditionally called::
     
    21032202    to applications which replace :func:`sys.stdin` with a "file-like object"
    21042203    with output buffering.  This danger is that if multiple processes call
    2105     :func:`close()` on this file-like object, it could result in the same
     2204    :meth:`~io.IOBase.close()` on this file-like object, it could result in the same
    21062205    data being flushed to the object multiple times, resulting in corruption.
    21072206
     
    21322231    that instead.
    21332232
    2134     Also, if you subclass :class:`Process` then make sure that instances will be
    2135     picklable when the :meth:`Process.start` method is called.
     2233    Also, if you subclass :class:`~multiprocessing.Process` then make sure that
     2234    instances will be picklable when the :meth:`Process.start
     2235    <multiprocessing.Process.start>` method is called.
    21362236
    21372237Global variables
     
    21392239    Bear in mind that if code run in a child process tries to access a global
    21402240    variable, then the value it sees (if any) may not be the same as the value
    2141     in the parent process at the time that :meth:`Process.start` was called.
     2241    in the parent process at the time that :meth:`Process.start
     2242    <multiprocessing.Process.start>` was called.
    21422243
    21432244    However, global variables which are just module level constants cause no
     
    21942295
    21952296
    2196 Using :class:`Pool`:
     2297Using :class:`~multiprocessing.pool.Pool`:
    21972298
    21982299.. literalinclude:: ../includes/mp_pool.py
     
    22042305
    22052306
    2206 An showing how to use queues to feed tasks to a collection of worker process and
    2207 collect the results:
     2307An example showing how to use queues to feed tasks to a collection of worker
     2308processes and collect the results:
    22082309
    22092310.. literalinclude:: ../includes/mp_workers.py
Note: See TracChangeset for help on using the changeset viewer.