Skip to content

Instantly share code, notes, and snippets.

@mkevac
Created October 17, 2014 17:42
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 mkevac/2006f7fa8be38fb1ee00 to your computer and use it in GitHub Desktop.
Save mkevac/2006f7fa8be38fb1ee00 to your computer and use it in GitHub Desktop.
package main
import (
"github.com/davecheney/profile"
)
func loop(in chan *int) {
var n int
for {
select {
case <-in:
case in <- &n:
}
}
}
func main() {
defer profile.Start(profile.MemProfile).Stop()
c := make(chan *int)
go loop(c)
for {
var n int
c <- &n
<-c
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment