diff options
Diffstat (limited to 'Lib/threading.py')
-rw-r--r-- | Lib/threading.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/threading.py b/Lib/threading.py index 72c8319..167f8c7 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -531,9 +531,11 @@ class _BoundedSemaphore(_Semaphore): raise a ValueError. """ - if self._Semaphore__value >= self._initial_value: - raise ValueError("Semaphore released too many times") - return _Semaphore.release(self) + with self._cond: + if self._value >= self._initial_value: + raise ValueError("Semaphore released too many times") + self._value += 1 + self._cond.notify() def Event(*args, **kwargs): |