summaryrefslogtreecommitdiffstats
path: root/Doc/library/asyncio-dev.rst
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-02-07 18:03:05 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-02-07 18:03:05 (GMT)
commit790202d61308efd3e7bc69cd61bff2306d789e57 (patch)
tree676e6bdd80f89850c75bd6757e4f2707f7a393ee /Doc/library/asyncio-dev.rst
parent3e7cc03f63755e2e719fa46aff9b94f648a8f68b (diff)
downloadcpython-790202d61308efd3e7bc69cd61bff2306d789e57.zip
cpython-790202d61308efd3e7bc69cd61bff2306d789e57.tar.gz
cpython-790202d61308efd3e7bc69cd61bff2306d789e57.tar.bz2
asyncio doc: mention that asyncio is not thread-safe
Diffstat (limited to 'Doc/library/asyncio-dev.rst')
-rw-r--r--Doc/library/asyncio-dev.rst6
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/library/asyncio-dev.rst b/Doc/library/asyncio-dev.rst
index 686e496..aab925b 100644
--- a/Doc/library/asyncio-dev.rst
+++ b/Doc/library/asyncio-dev.rst
@@ -23,6 +23,12 @@ schedule a coroutine from a different thread::
loop.call_soon_threadsafe(asyncio.async, coro_func())
+Most asyncio objects are not thread safe. You should only worry if you access
+objects outside the event loop. For example, to cancel a future, don't call
+directly its :meth:`Future.cancel` method, but::
+
+ loop.call_soon_threadsafe(fut.cancel)
+
To handle signals and to execute subprocesses, the event loop must be run in
the main thread.