Skip to content

Instantly share code, notes, and snippets.

@Sgeo
Created January 16, 2013 18:37
Show Gist options
  • Save Sgeo/4549582 to your computer and use it in GitHub Desktop.
Save Sgeo/4549582 to your computer and use it in GitHub Desktop.
waitFor: anAnnouncementClass
"Blocks the current process until anAnnouncementClass is announced.
Note that synchronous code using this method runs the risk of missing announcements."
| val sem |
sem := Semaphore new.
self on: anAnnouncementClass do: [:ann | val := ann. sem signal].
sem wait.
^val.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment