Source file
test/goprint.go
1
2
3
4
5
6
7
8
9 package main
10
11 import (
12 "log"
13 "runtime"
14 "time"
15 )
16
17 func main() {
18 numg0 := runtime.NumGoroutine()
19 deadline := time.Now().Add(10 * time.Second)
20 go println(42, true, false, true, 1.5, "world", (chan int)(nil), []int(nil), (map[string]int)(nil), (func())(nil), byte(255))
21 for {
22 numg := runtime.NumGoroutine()
23 if numg > numg0 {
24 if time.Now().After(deadline) {
25 log.Fatalf("%d goroutines > initial %d after deadline", numg, numg0)
26 }
27 runtime.Gosched()
28 continue
29 }
30 break
31 }
32 }
33
View as plain text