Skip to content

Instantly share code, notes, and snippets.

@yifan-gu
Last active August 29, 2015 14:05
Show Gist options
  • Save yifan-gu/dd93556cebebd655207c to your computer and use it in GitHub Desktop.
Save yifan-gu/dd93556cebebd655207c to your computer and use it in GitHub Desktop.
continuation
func processLoop() {
for {
// process the next event.
}
}
func (f *foo) a () {
// check a bunch of assumptions.
go func () {
// b is a time consuming func, it returns a chan.
future = b()
<-future
// put f.aa() in processing loop.
}
}
func (f *foo) aa () {
// check a bunch of assumptions again!!
// continue the work of f.a().
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment