Skip to content

Instantly share code, notes, and snippets.

@Cryolite
Last active July 24, 2017 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cryolite/d7a27ec349fce83c2245ab8bb1e4ad0f to your computer and use it in GitHub Desktop.
Save Cryolite/d7a27ec349fce83c2245ab8bb1e4ad0f to your computer and use it in GitHub Desktop.
observer = startObservingAsynchronousEvent(timeout=one_minute);
while (true) {
if (observer.eventOccurs()) break;
if (observer.eventOccursOrTimeout()) {
// if (observer.eventOccurs()) break;
throw TimeoutException();
}
sleep(one_second);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment