summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-02-25 13:24:15 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-02-25 13:24:15 (GMT)
commit83704963c0d4e7b1474d6102ed6287a7ae4907a8 (patch)
tree2c959817bccdef128ceca8f8f95311bbd693175f
parent532c69a4280185de3faf198776b6d5d75bdec095 (diff)
downloadcpython-83704963c0d4e7b1474d6102ed6287a7ae4907a8.zip
cpython-83704963c0d4e7b1474d6102ed6287a7ae4907a8.tar.gz
cpython-83704963c0d4e7b1474d6102ed6287a7ae4907a8.tar.bz2
asyncio: add a note about (non) thread safety in each class
-rw-r--r--Doc/library/asyncio-eventloop.rst5
-rw-r--r--Doc/library/asyncio-protocol.rst2
-rw-r--r--Doc/library/asyncio-queue.rst2
-rw-r--r--Doc/library/asyncio-stream.rst4
-rw-r--r--Doc/library/asyncio-subprocess.rst5
-rw-r--r--Doc/library/asyncio-task.rst4
6 files changed, 22 insertions, 0 deletions
diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst
index f2c8945..d27eb4b 100644
--- a/Doc/library/asyncio-eventloop.rst
+++ b/Doc/library/asyncio-eventloop.rst
@@ -22,6 +22,8 @@ It provides multiple facilities, amongst which:
Base class of event loops.
+ This class is :ref:`not thread safe <asyncio-multithreading>`.
+
Run an event loop
-----------------
@@ -104,6 +106,9 @@ keywords to your callback, use :func:`functools.partial`. For example,
Like :meth:`call_soon`, but thread safe.
+ See the :ref:`concurrency and multithreading <asyncio-multithreading>`
+ section of the documentation.
+
.. _asyncio-delayed-calls:
diff --git a/Doc/library/asyncio-protocol.rst b/Doc/library/asyncio-protocol.rst
index b6fcc48..2e671e8 100644
--- a/Doc/library/asyncio-protocol.rst
+++ b/Doc/library/asyncio-protocol.rst
@@ -23,6 +23,8 @@ then call the transport's methods for various purposes.
subprocess pipes. The methods available on a transport depend on
the transport's kind.
+The transport classes are :ref:`not thread safe <asyncio-multithreading>`.
+
BaseTransport
-------------
diff --git a/Doc/library/asyncio-queue.rst b/Doc/library/asyncio-queue.rst
index 19957a0..c82e08b 100644
--- a/Doc/library/asyncio-queue.rst
+++ b/Doc/library/asyncio-queue.rst
@@ -31,6 +31,8 @@ Queue
be interrupted between calling :meth:`qsize` and doing an operation on the
Queue.
+ This class is :ref:`not thread safe <asyncio-multithreading>`.
+
.. versionchanged:: 3.4.3
New :meth:`join` and :meth:`task_done` methods.
diff --git a/Doc/library/asyncio-stream.rst b/Doc/library/asyncio-stream.rst
index 22b7341..41b24ac 100644
--- a/Doc/library/asyncio-stream.rst
+++ b/Doc/library/asyncio-stream.rst
@@ -85,6 +85,8 @@ StreamReader
.. class:: StreamReader(limit=None, loop=None)
+ This class is :ref:`not thread safe <asyncio-multithreading>`.
+
.. method:: exception()
Get the exception.
@@ -155,6 +157,8 @@ StreamWriter
wait for flow control. It also adds a transport attribute which references
the :class:`Transport` directly.
+ This class is :ref:`not thread safe <asyncio-multithreading>`.
+
.. attribute:: transport
Transport.
diff --git a/Doc/library/asyncio-subprocess.rst b/Doc/library/asyncio-subprocess.rst
index 1334f5b..1b82030 100644
--- a/Doc/library/asyncio-subprocess.rst
+++ b/Doc/library/asyncio-subprocess.rst
@@ -193,6 +193,9 @@ Process
:meth:`~subprocess.Popen.wait` method of the :class:`~subprocess.Popen`
class is implemented as a busy loop.
+ This class is :ref:`not thread safe <asyncio-multithreading>`. See also the
+ :ref:`Subprocess and threads <asyncio-subprocess-threads>` section.
+
.. coroutinemethod:: wait()
Wait for child process to terminate. Set and return :attr:`returncode`
@@ -310,6 +313,8 @@ are limits:
subprocesses from other threads. Call the :func:`get_child_watcher`
function in the main thread to instantiate the child watcher.
+The :class:`asyncio.subprocess.Process` class is not thread safe.
+
.. seealso::
The :ref:`Concurrency and multithreading in asyncio
diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst
index edc05c3..158a0d8 100644
--- a/Doc/library/asyncio-task.rst
+++ b/Doc/library/asyncio-task.rst
@@ -209,6 +209,8 @@ Future
:func:`~concurrent.futures.as_completed` functions in the
:mod:`concurrent.futures` package.
+ This class is :ref:`not thread safe <asyncio-multithreading>`.
+
.. method:: cancel()
Cancel the future and schedule callbacks.
@@ -375,6 +377,8 @@ Task
Don't directly create :class:`Task` instances: use the :func:`async`
function or the :meth:`BaseEventLoop.create_task` method.
+ This class is :ref:`not thread safe <asyncio-multithreading>`.
+
.. classmethod:: all_tasks(loop=None)
Return a set of all tasks for an event loop.