Make ManualEvent.wait() work outside of a task. Fixes #663. See #729.