Skip to content

Instantly share code, notes, and snippets.

@collinvandyck
Created March 27, 2016 19:57
Show Gist options
  • Select an option

  • Save collinvandyck/147d87a5a0fae95c023f to your computer and use it in GitHub Desktop.

Select an option

Save collinvandyck/147d87a5a0fae95c023f to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"time"
"runtime"
)
func loopit() {
for {
select {
case <- time.After(10 * time.Millisecond):
}
}
}
func main() {
for i := 0; i < 100000; i++ {
go loopit()
}
for _ = range time.Tick(time.Second) {
numGoroutine := runtime.NumGoroutine()
fmt.Println("Num goroutines:", numGoroutine)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment