mirror of
https://github.com/python/cpython.git
synced 2025-09-18 22:50:26 +00:00
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:
parent
6cd1d6c6b1
commit
f7305a06c7
10 changed files with 89 additions and 6 deletions
|
@ -1059,12 +1059,14 @@ class IteratorProxy(BaseProxy):
|
|||
|
||||
|
||||
class AcquirerProxy(BaseProxy):
|
||||
_exposed_ = ('acquire', 'release')
|
||||
_exposed_ = ('acquire', 'release', 'locked')
|
||||
def acquire(self, blocking=True, timeout=None):
|
||||
args = (blocking,) if timeout is None else (blocking, timeout)
|
||||
return self._callmethod('acquire', args)
|
||||
def release(self):
|
||||
return self._callmethod('release')
|
||||
def locked(self):
|
||||
return self._callmethod('locked')
|
||||
def __enter__(self):
|
||||
return self._callmethod('acquire')
|
||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||
|
@ -1072,7 +1074,7 @@ class AcquirerProxy(BaseProxy):
|
|||
|
||||
|
||||
class ConditionProxy(AcquirerProxy):
|
||||
_exposed_ = ('acquire', 'release', 'wait', 'notify', 'notify_all')
|
||||
_exposed_ = ('acquire', 'release', 'locked', 'wait', 'notify', 'notify_all')
|
||||
def wait(self, timeout=None):
|
||||
return self._callmethod('wait', (timeout,))
|
||||
def notify(self, n=1):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue