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

Skip to content

Commit 7b2c3c6

Browse files
committed
asyncio doc: lock classes are not thread safe
1 parent ed135f4 commit 7b2c3c6

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

Doc/library/asyncio-sync.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ Lock
5454
Locks also support the context management protocol. ``(yield from lock)``
5555
should be used as context manager expression.
5656

57+
This class is :ref:`not thread safe <asyncio-multithreading>`.
58+
5759
Usage::
5860

5961
lock = Lock()
@@ -117,6 +119,8 @@ Event
117119
method. The :meth:`wait` method blocks until the flag is true. The flag is
118120
initially false.
119121

122+
This class is :ref:`not thread safe <asyncio-multithreading>`.
123+
120124
.. method:: clear()
121125

122126
Reset the internal flag to false. Subsequently, coroutines calling
@@ -160,6 +164,8 @@ Condition
160164
object, and it is used as the underlying lock. Otherwise,
161165
a new :class:`Lock` object is created and used as the underlying lock.
162166

167+
This class is :ref:`not thread safe <asyncio-multithreading>`.
168+
163169
.. coroutinemethod:: acquire()
164170

165171
Acquire the underlying lock.
@@ -252,6 +258,8 @@ Semaphore
252258
defaults to ``1``. If the value given is less than ``0``, :exc:`ValueError`
253259
is raised.
254260

261+
This class is :ref:`not thread safe <asyncio-multithreading>`.
262+
255263
.. coroutinemethod:: acquire()
256264

257265
Acquire a semaphore.
@@ -279,8 +287,8 @@ BoundedSemaphore
279287

280288
.. class:: BoundedSemaphore(value=1, \*, loop=None)
281289

282-
A bounded semaphore implementation. Inherit from :class:`Semaphore`.
290+
A bounded semaphore implementation. Inherit from :class:`Semaphore`.
283291

284-
This raises :exc:`ValueError` in :meth:`~Semaphore.release` if it would
285-
increase the value above the initial value.
292+
This raises :exc:`ValueError` in :meth:`~Semaphore.release` if it would
293+
increase the value above the initial value.
286294

0 commit comments

Comments
 (0)