summaryrefslogtreecommitdiffstats
path: root/Doc/library/asyncio-sync.rst
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-03-13 09:54:18 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-03-13 09:54:18 (GMT)
commit39930c9ca0e8ad2e1465e7a31b4a400d6f34ccff (patch)
treecff72f5bec7ed78f99f6af27158b3ccedc5b964f /Doc/library/asyncio-sync.rst
parentd079d3a2892cb40c7020190c6026a69b26383c10 (diff)
downloadcpython-39930c9ca0e8ad2e1465e7a31b4a400d6f34ccff.zip
cpython-39930c9ca0e8ad2e1465e7a31b4a400d6f34ccff.tar.gz
cpython-39930c9ca0e8ad2e1465e7a31b4a400d6f34ccff.tar.bz2
Close #20889: asyncio doc: Document acquire(), locked() and release() method of
Condition
Diffstat (limited to 'Doc/library/asyncio-sync.rst')
-rw-r--r--Doc/library/asyncio-sync.rst27
1 files changed, 26 insertions, 1 deletions
diff --git a/Doc/library/asyncio-sync.rst b/Doc/library/asyncio-sync.rst
index de38131..ceed5df 100644
--- a/Doc/library/asyncio-sync.rst
+++ b/Doc/library/asyncio-sync.rst
@@ -64,7 +64,7 @@ Lock
.. method:: locked()
- Return ``True`` if lock is acquired.
+ Return ``True`` if the lock is acquired.
.. method:: acquire()
@@ -141,6 +141,15 @@ Condition
A new :class:`Lock` object is created and used as the underlying lock.
+ .. method:: acquire()
+
+ Acquire the underlying lock.
+
+ This method blocks until the lock is unlocked, then sets it to locked and
+ returns ``True``.
+
+ This method is a :ref:`coroutine <coroutine>`.
+
.. method:: notify(n=1)
By default, wake up one coroutine waiting on this condition, if any.
@@ -156,6 +165,10 @@ Condition
call until it can reacquire the lock. Since :meth:`notify` does not
release the lock, its caller should.
+ .. method:: locked()
+
+ Return ``True`` if the underlying lock is acquired.
+
.. method:: notify_all()
Wake up all threads waiting on this condition. This method acts like
@@ -163,6 +176,18 @@ Condition
calling thread has not acquired the lock when this method is called, a
:exc:`RuntimeError` is raised.
+ .. method:: release()
+
+ Release the underlying lock.
+
+ When the lock is locked, reset it to unlocked, and return. If any other
+ coroutines are blocked waiting for the lock to become unlocked, allow
+ exactly one of them to proceed.
+
+ When invoked on an unlocked lock, a :exc:`RuntimeError` is raised.
+
+ There is no return value.
+
.. method:: wait()
Wait until notified.