gh-115942: Add locked to several multiprocessing locks (#115944)

Co-authored-by: mpage <mpage@cs.stanford.edu>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
This commit is contained in:
sobolevn 2025-04-08 11:14:12 +03:00 committed by GitHub
parent 6cd1d6c6b1
commit f7305a06c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 89 additions and 6 deletions

View file

@ -1421,6 +1421,13 @@ object -- see :ref:`multiprocessing-managers`.
when invoked on an unlocked lock, a :exc:`ValueError` is raised.
.. method:: locked()
Return a boolean indicating whether this object is locked right now.
.. versionadded:: next
.. class:: RLock()
A recursive lock object: a close analog of :class:`threading.RLock`. A
@ -1481,6 +1488,13 @@ object -- see :ref:`multiprocessing-managers`.
differs from the implemented behavior in :meth:`threading.RLock.release`.
.. method:: locked()
Return a boolean indicating whether this object is locked right now.
.. versionadded:: next
.. class:: Semaphore([value])
A semaphore object: a close analog of :class:`threading.Semaphore`.

View file

@ -709,6 +709,13 @@ call release as many times the lock has been acquired can lead to deadlock.
There is no return value.
.. method:: locked()
Return a boolean indicating whether this object is locked right now.
.. versionadded:: next
.. _condition-objects:
Condition Objects
@ -801,6 +808,12 @@ item to the buffer only needs to wake up one consumer thread.
Release the underlying lock. This method calls the corresponding method on
the underlying lock; there is no return value.
.. method:: locked()
Return a boolean indicating whether this object is locked right now.
.. versionadded:: next
.. method:: wait(timeout=None)
Wait until notified or until a timeout occurs. If the calling thread has