1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| package main
import ( "fmt" "log" "net/http" _ "net/http/pprof" "time" )
var c = make(chan int)
func main() {
go func() { for range time.Tick(time.Microsecond*100){ c <- time.Now().Second() } }()
for i := 0; i < 100; i++ { go func() { for { fmt.Println(<-c) } }() }
http.HandleFunc("/ping", func(writer http.ResponseWriter, request *http.Request) { select {} })
log.Fatal(http.ListenAndServe(":8080",nil)) }
|