Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7a55b88

Browse files
committed
Issue #21962, asyncio doc: Suggest the usage of wait_for() to replace
the lack of timeout parameter for locks and queues.
1 parent 1241ecc commit 7a55b88

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Doc/library/asyncio-sync.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,29 @@
44
Synchronization primitives
55
==========================
66

7+
Locks:
8+
9+
* :class:`Lock`
10+
* :class:`Event`
11+
* :class:`Condition`
12+
* :class:`Semaphore`
13+
* :class:`BoundedSemaphore`
14+
15+
Queues:
16+
17+
* :class:`Queue`
18+
* :class:`PriorityQueue`
19+
* :class:`LifoQueue`
20+
* :class:`JoinableQueue`
21+
22+
asyncio locks and queues API were designed to be close to classes of the
23+
:mod:`threading` module (:class:`~threading.Lock`, :class:`~threading.Event`,
24+
:class:`~threading.Condition`, :class:`~threading.Semaphore`,
25+
:class:`~threading.BoundedSemaphore`) and the :mod:`queue` module
26+
(:class:`~queue.Queue`, :class:`~queue.PriorityQueue`,
27+
:class:`~queue.LifoQueue`), but they have no *timeout* parameter. The
28+
:func:`asyncio.wait_for` function can be used to cancel a task after a timeout.
29+
730
Locks
831
-----
932

0 commit comments

Comments
 (0)