]> granicus.if.org Git - python/commitdiff
bpo-36794: Document that Lock.acquire is fair. (GH-13082)
authorHrvoje Nikšić <hniksic@gmail.com>
Wed, 29 May 2019 17:08:17 +0000 (19:08 +0200)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 29 May 2019 17:08:17 +0000 (10:08 -0700)
https://bugs.python.org/issue36794

Doc/library/asyncio-sync.rst

index e3f18ccb4341fe5026e464891d11824ecbd33559..79f6b02d85e2e535a411f908ee6d6f8bf965b28c 100644 (file)
@@ -66,6 +66,13 @@ Lock
       This method waits until the lock is *unlocked*, sets it to
       *locked* and returns ``True``.
 
+      When more than one coroutine is blocked in :meth:`acquire`
+      waiting for the lock to be unlocked, only one coroutine
+      eventually proceeds.
+
+      Acquiring a lock is *fair*: the coroutine that proceeds will be
+      the first coroutine that started waiting on the lock.
+
    .. method:: release()
 
       Release the lock.