From 0a8ffe9c2679c2de1937ee2ac94985b1186e5af2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hrvoje=20Nik=C5=A1i=C4=87?= Date: Wed, 29 May 2019 19:08:17 +0200 Subject: [PATCH] bpo-36794: Document that Lock.acquire is fair. (GH-13082) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://bugs.python.org/issue36794 (cherry picked from commit 34f4f5efea730504216ee19f237734e0bb0104ee) Co-authored-by: Hrvoje Nikšić --- Doc/library/asyncio-sync.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Doc/library/asyncio-sync.rst b/Doc/library/asyncio-sync.rst index 291310d71414e8..993bd13fb03013 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.