From: Ben Darnell Date: Sun, 5 Feb 2017 22:43:39 +0000 (-0500) Subject: queues: Call out thread-unsafety in docs X-Git-Tag: v4.5.0~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4ab372a775e829483ca77f1972a34537d625911;p=thirdparty%2Ftornado.git queues: Call out thread-unsafety in docs Fixes #1923 --- diff --git a/docs/locks.rst b/docs/locks.rst index 7115b0da7..94184db2a 100644 --- a/docs/locks.rst +++ b/docs/locks.rst @@ -6,10 +6,12 @@ Coordinate coroutines with synchronization primitives analogous to those the standard library provides to threads. -*(Note that these primitives are not actually thread-safe and cannot be used in -place of those from the standard library--they are meant to coordinate Tornado -coroutines in a single-threaded app, not to protect shared objects in a -multithreaded app.)* +.. warning:: + + Note that these primitives are not actually thread-safe and cannot be used in + place of those from the standard library--they are meant to coordinate Tornado + coroutines in a single-threaded app, not to protect shared objects in a + multithreaded app. .. automodule:: tornado.locks diff --git a/tornado/queues.py b/tornado/queues.py index b8e9b5693..77eda98b0 100644 --- a/tornado/queues.py +++ b/tornado/queues.py @@ -12,6 +12,16 @@ # License for the specific language governing permissions and limitations # under the License. +"""Asynchronous queues for coroutines. + +.. warning:: + + Unlike the standard library's `queue` module, the classes defined here + are *not* thread-safe. To use these queues from another thread, + use `.IOLoop.add_callback` to transfer control to the `.IOLoop` thread + before calling any queue methods. +""" + from __future__ import absolute_import, division, print_function, with_statement import collections