[Python-bugs-list] [ python-Bugs-452836 ] BoundedSemaphore class
noreply@sourceforge.net
noreply@sourceforge.net
Sun, 19 Aug 2001 19:34:54 -0700
Bugs item #452836, was opened at 2001-08-18 23:01
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=452836&group_id=5470
Category: Python Library
Group: Feature Request
Status: Open
Resolution: None
Priority: 5
Submitted By: Skip Montanaro (montanaro)
>Assigned to: Tim Peters (tim_one)
Summary: BoundedSemaphore class
Initial Comment:
Per Guido's request, here's a simple BoundedSemaphore
class, including doc update (and simple example)
as well as a rudimentary test_threading.py which
draws heavily from test_thread.py.
Assigned to Tim, since he's probably the most likely
person to check the BoundedSemaphore code.
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2001-08-19 19:34
Message:
Logged In: YES
user_id=31435
Thanks, Skip! I assigned this back to me (no time this
instant; will get back to it later tonight).
----------------------------------------------------------------------
Comment By: Skip Montanaro (montanaro)
Date: 2001-08-19 17:47
Message:
Logged In: YES
user_id=44345
I got rid of the assert and just test the value, raising
ValueError if it's out of whack. Actually, there was
another bug before as well. I shouldn't have been testing
self.__value, but self._Semaphore__value. In the
test_threading.py file I wrote for some reason I called
Semaphore instead of BoundedSemaphore. That's also been
fixed.
I modelled the name of self.__initial_value after
self.__value, but have changed it to only have a single
leading underscore.
Skip
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2001-08-19 14:32
Message:
Logged In: YES
user_id=31435
Back to Skip.
+ Think of a way to do this without using "assert":
BoundedSempahore doesn't do its job under -O as-is, because
asserts vanish, and UnreliableBoundedSemaphore would be an
unwieldy class name <wink>.
+ Consider renaming __initial_value to _initial_value;
there's no reason to hide this from subclasses, right?
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=452836&group_id=5470