Source file
test/fixedbugs/issue25897b.go
1
2
3
4
5
6
7
8
9
10 package main
11
12 import (
13 "reflect"
14 "runtime"
15 )
16
17 const N = 100
18
19 type T struct {
20 }
21
22 func (t *T) Foo(c chan bool) {
23 c <- true
24 }
25
26 func main() {
27 t := &T{}
28 runtime.GOMAXPROCS(1)
29 c := make(chan bool, N)
30 for i := 0; i < N; i++ {
31 f := reflect.ValueOf(t).MethodByName("Foo").Interface().(func(chan bool))
32 go f(c)
33 }
34 runtime.GC()
35 for i := 0; i < N; i++ {
36 <-c
37 }
38 }
39
View as plain text