Skip to content

Instantly share code, notes, and snippets.

@nilium
Created March 19, 2014 00:41
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 nilium/9633266 to your computer and use it in GitHub Desktop.
Save nilium/9633266 to your computer and use it in GitHub Desktop.
type signalFunc func()
type waitFunc func()
// signalWaitFuncs returns a signalFunc and a waitFunc. Calling the returned
// waitFunc blocks until the signalFunc is called.
func signalWaitFuncs() (signalFunc, waitFunc) {
port := make(chan bool)
return func() { port <- true }, func() { <-port }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment