Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions tornado/locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ def wait(

Returns a `.Future` that resolves ``True`` if the condition is notified,
or ``False`` after a timeout.

.. versionchanged:: 6.6
A ``timeout`` argument of zero will either return or raise immediately.
Previously, zero was treated equivalent to ``None`` (wait forever).
"""
waiter: Future[bool] = Future()
self._waiters.append(waiter)
Expand Down Expand Up @@ -231,6 +235,10 @@ def wait(

Returns an awaitable, which raises `tornado.util.TimeoutError` after a
timeout.

.. versionchanged:: 6.6
A ``timeout`` argument of zero will either return or raise immediately.
Previously, zero was treated equivalent to ``None`` (wait forever).
"""
fut: Future[None] = Future()
if self._value:
Expand Down Expand Up @@ -414,6 +422,10 @@ def acquire(

Block if the counter is zero and wait for a `.release`. The awaitable
raises `.TimeoutError` after the deadline.

.. versionchanged:: 6.6
A ``timeout`` argument of zero will either return or raise immediately.
Previously, zero was treated equivalent to ``None`` (wait forever).
"""
waiter: Future[_ReleasingContextManager] = Future()
if self._value > 0:
Expand Down Expand Up @@ -528,6 +540,10 @@ def acquire(

Returns an awaitable, which raises `tornado.util.TimeoutError` after a
timeout.

.. versionchanged:: 6.6
A ``timeout`` argument of zero will either return or raise immediately.
Previously, zero was treated equivalent to ``None`` (wait forever).
"""
return self._block.acquire(timeout)

Expand Down
11 changes: 11 additions & 0 deletions tornado/queues.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ def put(
scale as `tornado.ioloop.IOLoop.time`, normally `time.time`), or a
`datetime.timedelta` object for a deadline relative to the
current time.

.. versionchanged:: 6.6
A ``timeout`` argument of zero will either return or raise immediately.
Previously, zero was treated equivalent to ``None`` (wait forever).
"""
future: Future[None] = Future()
try:
Expand Down Expand Up @@ -240,6 +244,9 @@ def get(self, timeout: float | datetime.timedelta | None = None) -> Awaitable[_T
``timedelta`` objects for relative timeouts (consistent
with other timeouts in Tornado).

.. versionchanged:: 6.6
A ``timeout`` argument of zero will either return or raise immediately.
Previously, zero was treated equivalent to ``None`` (wait forever).
"""
future: Future[_T] = Future()
try:
Expand Down Expand Up @@ -292,6 +299,10 @@ def join(

Returns an awaitable, which raises `tornado.util.TimeoutError` after a
timeout.

.. versionchanged:: 6.6
A ``timeout`` argument of zero will either return or raise immediately.
Previously, zero was treated equivalent to ``None`` (wait forever).
"""
return self._finished.wait(timeout)

Expand Down
Loading