summaryrefslogtreecommitdiffstats
path: root/Doc/library/multiprocessing.rst
diff options
context:
space:
mode:
authorRichard Oudkerk <shibturn@gmail.com>2012-06-18 16:47:52 (GMT)
committerRichard Oudkerk <shibturn@gmail.com>2012-06-18 16:47:52 (GMT)
commitd69cfe88eae5b177b1aaf51c39e85fb92c34cf22 (patch)
tree43151241e2aab605f65e3634affd630ea6e084a3 /Doc/library/multiprocessing.rst
parent0f884273b0319272ca32d529af5c761d6dfa8a34 (diff)
downloadcpython-d69cfe88eae5b177b1aaf51c39e85fb92c34cf22.zip
cpython-d69cfe88eae5b177b1aaf51c39e85fb92c34cf22.tar.gz
cpython-d69cfe88eae5b177b1aaf51c39e85fb92c34cf22.tar.bz2
Issue #15064: Implement context manager protocol for multiprocessing types
Diffstat (limited to 'Doc/library/multiprocessing.rst')
-rw-r--r--Doc/library/multiprocessing.rst17
1 files changed, 17 insertions, 0 deletions
diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst
index 4171977..2f64bb1 100644
--- a/Doc/library/multiprocessing.rst
+++ b/Doc/library/multiprocessing.rst
@@ -834,6 +834,10 @@ Connection objects are usually created using :func:`Pipe` -- see also
Connection objects themselves can now be transferred between processes
using :meth:`Connection.send` and :meth:`Connection.recv`.
+ .. versionadded:: 3.3
+ Connection objects now support the context manager protocol -- see
+ :ref:`typecontextmanager`. :meth:`__enter__` returns the
+ connection object, and :meth:`__exit__` calls :meth:`close`.
For example:
@@ -1277,6 +1281,9 @@ their parent process exits. The manager classes are defined in the
The address used by the manager.
+ Manager objects support the context manager protocol -- see
+ :ref:`typecontextmanager`. :meth:`__enter__` returns the
+ manager object, and :meth:`__exit__` calls :meth:`shutdown`.
.. class:: SyncManager
@@ -1747,6 +1754,11 @@ with the :class:`Pool` class.
Wait for the worker processes to exit. One must call :meth:`close` or
:meth:`terminate` before using :meth:`join`.
+ .. versionadded:: 3.3
+ Pool objects now support the context manager protocol -- see
+ :ref:`typecontextmanager`. :meth:`__enter__` returns the pool
+ object, and :meth:`__exit__` calls :meth:`terminate`.
+
.. class:: AsyncResult
@@ -1911,6 +1923,11 @@ multiple connections at the same time.
The address from which the last accepted connection came. If this is
unavailable then it is ``None``.
+ .. versionadded:: 3.3
+ Listener objects now support the context manager protocol -- see
+ :ref:`typecontextmanager`. :meth:`__enter__` returns the
+ listener object, and :meth:`__exit__` calls :meth:`close`.
+
.. function:: wait(object_list, timeout=None)
Wait till an object in *object_list* is ready. Returns the list of