[issue29449] clear() should return prior state in threading.Event
Tim Peters
report at bugs.python.org
Wed Feb 8 00:04:57 EST 2017
Tim Peters added the comment:
I can't judge a use case for a thread gimmick in the absence of wholly specified examples. There are too many possible subtleties. Indeed, if I'd do anything with Event.clear() it would be to remove it - I've seen too much code that suffers subtle race bugs when trying to reset an event. The one thing it's clearly good for is announcing a one-time global state change, for which it's sufficient, efficient, clear, and hard to get wrong.
Can you use a Barrier instead? The Barrier design allows reuse with no special care, Barrier.wait() already returns a little integer unique to each thread, and the Barrier constructor even allows a function to be passed in to be executed by (exactly) one of the threads when the Barrier is complete.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29449>
_______________________________________
More information about the Python-bugs-list
mailing list