From: Hrvoje Nikšić Date: Wed, 29 May 2019 17:08:17 +0000 (+0200) Subject: bpo-36794: Document that Lock.acquire is fair. (GH-13082) X-Git-Tag: v3.8.0b1~140 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=34f4f5efea730504216ee19f237734e0bb0104ee;p=python bpo-36794: Document that Lock.acquire is fair. (GH-13082) https://bugs.python.org/issue36794 --- diff --git a/Doc/library/asyncio-sync.rst b/Doc/library/asyncio-sync.rst index e3f18ccb43..79f6b02d85 100644 --- a/Doc/library/asyncio-sync.rst +++ b/Doc/library/asyncio-sync.rst @@ -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.