]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Add comment about (non-)thread-safety of IOLoop.add_timeout.
authorBen Darnell <ben@bendarnell.com>
Tue, 3 Jan 2012 03:17:57 +0000 (19:17 -0800)
committerBen Darnell <ben@bendarnell.com>
Tue, 3 Jan 2012 03:17:57 +0000 (19:17 -0800)
tornado/ioloop.py

index 4ed638e7eba15110f0f6e036c7d3d23f7c12d0fe..edd2fec2e3ee27f97d4c0b9c80f845c6eb00f10c 100644 (file)
@@ -352,6 +352,10 @@ class IOLoop(object):
         ``deadline`` may be a number denoting a unix timestamp (as returned
         by ``time.time()`` or a ``datetime.timedelta`` object for a deadline
         relative to the current time.
+
+        Note that it is not safe to call `add_timeout` from other threads.
+        Instead, you must use `add_callback` to transfer control to the
+        IOLoop's thread, and then call `add_timeout` from there.
         """
         timeout = _Timeout(deadline, stack_context.wrap(callback))
         heapq.heappush(self._timeouts, timeout)