MOVED: while code to wait for an event

This topic has been moved to Programming Questions.