Message148604
The documentation for Event.wait says:
This method returns the internal flag on exit, so it will always return True except if a timeout is given and the operation times out.
In fact, however, if the thread that sets the flag immediately clears it, wait will return False. Antoine looking at the code says that this appears to be intentional, and that would make sense since originally wait returned no value.
My use case is one thread waiting on another to complete a work loop. Normally the worker thread goes to sleep after clearing the flag, but sometimes it immediately starts a new work loop. In either case I want the monitoring loop to take an action when the work loop completes, and raise an error if the wait times out. It looked to me like Event.wait would work in the scenario. |
|
Date |
User |
Action |
Args |
2011-11-29 20:45:16 | r.david.murray | set | recipients:
+ r.david.murray, tim.peters, pitrou, docs@python |
2011-11-29 20:45:16 | r.david.murray | set | messageid: <1322599516.14.0.0239672713193.issue13502@psf.upfronthosting.co.za> |
2011-11-29 20:45:15 | r.david.murray | link | issue13502 messages |
2011-11-29 20:45:15 | r.david.murray | create | |
|