Use plain Event() objects to control task waits.
Revert "Use plain Event() objects to control task waits."

This reverts commit 4363dba52ab0616abf77b642d3c07ca6ce35ad78.
Clear the events after wait() intead of after set().
Fix bug on condition_wait().

If the condition was true upon start, the method did not return until
the next call to notify().