diff options
author | Skip Montanaro <skip@pobox.com> | 2001-08-19 04:25:24 (GMT) |
---|---|---|
committer | Skip Montanaro <skip@pobox.com> | 2001-08-19 04:25:24 (GMT) |
commit | b446fc7f2749c2335fc301d60e8f011d447875d3 (patch) | |
tree | dabdcb7b2f726773f8ad1157d73649fe6cc6293d /Lib | |
parent | dbec7d2c166650aa30dc35f373fc337fab35aa28 (diff) | |
download | cpython-b446fc7f2749c2335fc301d60e8f011d447875d3.zip cpython-b446fc7f2749c2335fc301d60e8f011d447875d3.tar.gz cpython-b446fc7f2749c2335fc301d60e8f011d447875d3.tar.bz2 |
add debug calls to self._note for the Semaphore class. This closes bug
443614. I will submit a new feature request and patch to threading.py and
libthreading.tex to address the bounded semaphore issue.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/threading.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/threading.py b/Lib/threading.py index 0936e31..e0d1cc0 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -261,9 +261,15 @@ class _Semaphore(_Verbose): while self.__value == 0: if not blocking: break + if __debug__: + self._note("%s.acquire(%s): blocked waiting, value=%s", + self, blocking, self.__value) self.__cond.wait() else: self.__value = self.__value - 1 + if __debug__: + self._note("%s.acquire: success, value=%s(%s)", + self, self.__value, self.__initial_value) rc = 1 self.__cond.release() return rc @@ -271,6 +277,9 @@ class _Semaphore(_Verbose): def release(self): self.__cond.acquire() self.__value = self.__value + 1 + if __debug__: + self._note("%s.release: success, value=%s(%s)", + self, self.__value, self.__initial_value) self.__cond.notify() self.__cond.release() |