From 2614cd3c674724ddd825a21d226251b0bcc9ac27 Mon Sep 17 00:00:00 2001 From: Daniel Giger Date: Tue, 30 Aug 2022 20:26:02 -0400 Subject: [PATCH 1/2] fix documentation for _thread.lock.acquire --- Doc/library/_thread.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/library/_thread.rst b/Doc/library/_thread.rst index d61ce9039349db..1c0a477c23e83e 100644 --- a/Doc/library/_thread.rst +++ b/Doc/library/_thread.rst @@ -157,21 +157,21 @@ This module defines the following constants and functions: Lock objects have the following methods: -.. method:: lock.acquire(waitflag=1, timeout=-1) +.. method:: lock.acquire(blocking=True, timeout=-1) Without any optional argument, this method acquires the lock unconditionally, if necessary waiting until it is released by another thread (only one thread at a time can acquire a lock --- that's their reason for existence). - If the integer *waitflag* argument is present, the action depends on its - value: if it is zero, the lock is only acquired if it can be acquired - immediately without waiting, while if it is nonzero, the lock is acquired + If the *blocking* argument is present, the action depends on its + value: if it is False, the lock is only acquired if it can be acquired + immediately without waiting, while if it is True, the lock is acquired unconditionally as above. If the floating-point *timeout* argument is present and positive, it specifies the maximum wait time in seconds before returning. A negative *timeout* argument specifies an unbounded wait. You cannot specify - a *timeout* if *waitflag* is zero. + a *timeout* if blocking is False. The return value is ``True`` if the lock is acquired successfully, ``False`` if not. From 239c0f48d89de0dc054456a3843e0003610c94f9 Mon Sep 17 00:00:00 2001 From: Daniel Giger Date: Tue, 30 Aug 2022 20:48:46 -0400 Subject: [PATCH 2/2] update formatting of _thread.lock.acquire() doc --- Doc/library/_thread.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/_thread.rst b/Doc/library/_thread.rst index 1c0a477c23e83e..9df9e7914e093b 100644 --- a/Doc/library/_thread.rst +++ b/Doc/library/_thread.rst @@ -171,7 +171,7 @@ Lock objects have the following methods: If the floating-point *timeout* argument is present and positive, it specifies the maximum wait time in seconds before returning. A negative *timeout* argument specifies an unbounded wait. You cannot specify - a *timeout* if blocking is False. + a *timeout* if *blocking* is False. The return value is ``True`` if the lock is acquired successfully, ``False`` if not.