[issue8486] [PATCH] threading.Event()

2010-04-21 Thread Benjamin VENELLE
Benjamin VENELLE added the comment: > In this case, you don't have to use an Event. A boolean attribute on one > of your objects is enough. > (similarly, you would use a "volatile" variable in C) This is already the case with Event. Look at threading.py @line ~355 Event class has a kinda priva

[issue8486] [PATCH] threading.Event()

2010-04-21 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Yes, I agree when Event objects are used to sync threads. But in my > case, I'm using them like signals to terminate some server's thread > through a proper way. In this case, you don't have to use an Event. A boolean attribute on one of your objects is enoug

[issue8486] [PATCH] threading.Event()

2010-04-21 Thread Benjamin VENELLE
Benjamin VENELLE added the comment: Yes, I agree when Event objects are used to sync threads. But in my case, I'm using them like signals to terminate some server's thread through a proper way. This is a just a "cosmetic" stuff to enhance readability. -- _

[issue8486] [PATCH] threading.Event()

2010-04-21 Thread Antoine Pitrou
Antoine Pitrou added the comment: Due to the nature of an Event, you should in most situations wait() on it, rather than test its value. Also, changing the boolean value of an Event would break existing code. I therefore think this should be rejected. -- nosy: +pitrou ___

[issue8486] [PATCH] threading.Event()

2010-04-21 Thread Benjamin VENELLE
New submission from Benjamin VENELLE : Hi, I'm suggesting to declare a __bool__() function as an alias for is_set() in Event class from threading package. So Event objects could be used like booleans. Ex: I thought 'while(not event): do_something()' is much intuitive than 'while(not event.i