summaryrefslogtreecommitdiffstats
path: root/Doc/library/multiprocessing.rst
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-08-25 21:05:21 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-08-25 21:05:21 (GMT)
commita786b026c9992cee195b7a550bab2c70c50f874f (patch)
tree55797a2c0cb4136e097faae6936271f65ade8bf4 /Doc/library/multiprocessing.rst
parent2532967122a54a6549238c799e01d5c18498279a (diff)
downloadcpython-a786b026c9992cee195b7a550bab2c70c50f874f.zip
cpython-a786b026c9992cee195b7a550bab2c70c50f874f.tar.gz
cpython-a786b026c9992cee195b7a550bab2c70c50f874f.tar.bz2
Merged revisions 65910,65977,65980,65984,65986,66000,66011-66012,66014,66017,66020 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r65910 | benjamin.peterson | 2008-08-20 09:07:59 -0500 (Wed, 20 Aug 2008) | 1 line fix up the multiprocessing docs a little ........ r65977 | christian.heimes | 2008-08-22 14:47:25 -0500 (Fri, 22 Aug 2008) | 3 lines Silenced compiler warning Objects/stringlib/find.h:97: warning: 'stringlib_contains_obj' defined but not used Reviewed by Benjamin Peterson ........ r65980 | christian.heimes | 2008-08-22 15:10:27 -0500 (Fri, 22 Aug 2008) | 3 lines Fixed two format strings in the _collections module. For example Modules/_collectionsmodule.c:674: warning: format '%i' expects type 'int', but argument 2 has type 'Py_ssize_t' Reviewed by Benjamin Peterson ........ r65984 | christian.heimes | 2008-08-22 16:23:47 -0500 (Fri, 22 Aug 2008) | 1 line d is the correct format string ........ r65986 | mark.hammond | 2008-08-22 19:59:14 -0500 (Fri, 22 Aug 2008) | 2 lines Fix bug 3625: test issues on 64bit windows. r=pitrou ........ r66000 | benjamin.peterson | 2008-08-23 15:27:43 -0500 (Sat, 23 Aug 2008) | 5 lines #3643 add a few more checks to _testcapi to prevent segfaults Author: Victor Stinner Reviewer: Benjamin Peterson ........ r66011 | neal.norwitz | 2008-08-24 12:27:43 -0500 (Sun, 24 Aug 2008) | 1 line Ignore a couple more tests that report leaks inconsistently. ........ r66012 | neal.norwitz | 2008-08-24 12:29:53 -0500 (Sun, 24 Aug 2008) | 1 line Use the actual blacklist of leaky tests ........ r66014 | georg.brandl | 2008-08-24 13:11:07 -0500 (Sun, 24 Aug 2008) | 2 lines #3654: fix duplicate test method name. Review by Benjamin P. ........ r66017 | benjamin.peterson | 2008-08-24 16:55:03 -0500 (Sun, 24 Aug 2008) | 1 line remove note about unimplemented feature ........ r66020 | brett.cannon | 2008-08-24 18:15:19 -0500 (Sun, 24 Aug 2008) | 1 line Clarify that some attributes/methods are listed somewhat separately because they are not part of the threading API. ........
Diffstat (limited to 'Doc/library/multiprocessing.rst')
-rw-r--r--Doc/library/multiprocessing.rst59
1 files changed, 24 insertions, 35 deletions
diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst
index 4bbd94c..a247e2f 100644
--- a/Doc/library/multiprocessing.rst
+++ b/Doc/library/multiprocessing.rst
@@ -248,7 +248,7 @@ The :mod:`multiprocessing` package mostly replicates the API of the
The constructor should always be called with keyword arguments. *group*
should always be ``None``; it exists solely for compatibility with
- :class:`~threading.Thread`. *target* is the callable object to be invoked by
+ :class:`threading.Thread`. *target* is the callable object to be invoked by
the :meth:`run()` method. It defaults to ``None``, meaning nothing is
called. *name* is the process name. By default, a unique name is constructed
of the form 'Process-N\ :sub:`1`:N\ :sub:`2`:...:N\ :sub:`k`' where N\
@@ -290,13 +290,9 @@ The :mod:`multiprocessing` package mostly replicates the API of the
A process cannot join itself because this would cause a deadlock. It is
an error to attempt to join a process before it has been started.
- .. attribute:: Process.name
+ .. attribute:: name
- Return the process's name.
-
- .. attribute:: Process.name = name
-
- Set the process's name.
+ The process's name.
The name is a string used for identification purposes only. It has no
semantics. Multiple processes may be given the same name. The initial
@@ -309,14 +305,10 @@ The :mod:`multiprocessing` package mostly replicates the API of the
Roughly, a process object is alive from the moment the :meth:`start`
method returns until the child process terminates.
- .. attribute:: Process.daemon
-
- Return the process's daemon flag., this is a boolean.
+ .. attribute:: daemon
- .. attribute:: Process.daemon = daemonic
-
- Set the process's daemon flag to the Boolean value *daemonic*. This must
- be called before :meth:`start` is called.
+ The process's daemon flag, a Boolean value. This must be called before
+ :meth:`start` is called.
The initial value is inherited from the creating process.
@@ -327,36 +319,33 @@ The :mod:`multiprocessing` package mostly replicates the API of the
Otherwise a daemonic process would leave its children orphaned if it gets
terminated when its parent process exits.
- In addition process objects also support the following methods:
+ In addition to the :class:`Threading.Thread` API, :class:`Process` objects
+ also support the following attributes and methods:
- .. attribute:: Process.pid
+ .. attribute:: pid
Return the process ID. Before the process is spawned, this will be
``None``.
- .. attribute:: Process.exitcode
+ .. attribute:: exitcode
- Return the child's exit code. This will be ``None`` if the process has
- not yet terminated. A negative value *-N* indicates that the child was
- terminated by signal *N*.
+ The child's exit code. This will be ``None`` if the process has not yet
+ terminated. A negative value *-N* indicates that the child was terminated
+ by signal *N*.
- .. attribute:: Process.authkey
+ .. attribute:: authkey
- Return the process's authentication key (a byte string).
+ The process's authentication key (a byte string).
When :mod:`multiprocessing` is initialized the main process is assigned a
random string using :func:`os.random`.
When a :class:`Process` object is created, it will inherit the
- authentication key of its parent process, although this may be changed
- using :attr:`Process.authkey` below.
+ authentication key of its parent process, although this may be changed by
+ setting :attr:`authkey` to another byte string.
See :ref:`multiprocessing-auth-keys`.
- .. attribute:: Process.authkey = authkey
-
- Set the process's authentication key which must be a byte string.
-
.. method:: terminate()
Terminate the process. On Unix this is done using the ``SIGTERM`` signal;
@@ -375,8 +364,8 @@ The :mod:`multiprocessing` package mostly replicates the API of the
cause other processes to deadlock.
Note that the :meth:`start`, :meth:`join`, :meth:`is_alive` and
- :meth:`get_exit_code` methods should only be called by the process that
- created the process object.
+ :attr:`exit_code` methods should only be called by the process that created
+ the process object.
Example usage of some of the methods of :class:`Process`::
@@ -390,7 +379,7 @@ The :mod:`multiprocessing` package mostly replicates the API of the
>>> p.terminate()
>>> print p, p.is_alive()
<Process(Process-1, stopped[SIGTERM])> False
- >>> p.get_exit_code() == -signal.SIGTERM
+ >>> p.exitcode == -signal.SIGTERM
True
@@ -1075,7 +1064,7 @@ their parent process exits. The manager classes are defined in the
*authkey* is the authentication key which will be used to check the validity
of incoming connections to the server process. If *authkey* is ``None`` then
- ``current_process().get_auth_key()``. Otherwise *authkey* is used and it
+ ``current_process().authkey``. Otherwise *authkey* is used and it
must be a string.
.. method:: start()
@@ -1599,7 +1588,7 @@ authentication* using the :mod:`hmac` module.
If *authentication* is ``True`` or *authkey* is a string then digest
authentication is used. The key used for authentication will be either
- *authkey* or ``current_process().get_auth_key()`` if *authkey* is ``None``.
+ *authkey* or ``current_process().authkey)`` if *authkey* is ``None``.
If authentication fails then :exc:`AuthenticationError` is raised. See
:ref:`multiprocessing-auth-keys`.
@@ -1632,7 +1621,7 @@ authentication* using the :mod:`hmac` module.
otherwise it must be *None*.
If *authkey* is ``None`` and *authenticate* is ``True`` then
- ``current_process().get_auth_key()`` is used as the authentication key. If
+ ``current_process().authkey`` is used as the authentication key. If
*authkey* is ``None`` and *authentication* is ``False`` then no
authentication is done. If authentication fails then
:exc:`AuthenticationError` is raised. See :ref:`multiprocessing-auth-keys`.
@@ -1748,7 +1737,7 @@ authentication key. (Demonstrating that both ends are using the same key does
**not** involve sending the key over the connection.)
If authentication is requested but do authentication key is specified then the
-return value of ``current_process().get_auth_key`` is used (see
+return value of ``current_process().authkey`` is used (see
:class:`~multiprocessing.Process`). This value will automatically inherited by
any :class:`~multiprocessing.Process` object that the current process creates.
This means that (by default) all processes of a multi-process program will share