Source file
test/fixedbugs/issue25897a.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 func main() {
20 runtime.GOMAXPROCS(1)
21
22
23
24 go func() {
25 for {
26 runtime.GC()
27 }
28 }()
29 c := make(chan bool, N)
30 for i := 0; i < N; i++ {
31
32
33
34 f := reflect.MakeFunc(reflect.TypeOf(((func(*int))(nil))),
35 func(args []reflect.Value) []reflect.Value {
36 c <- true
37 return nil
38 }).Interface().(func(*int))
39 go f(nil)
40
41 g := reflect.MakeFunc(reflect.TypeOf(((func())(nil))),
42 func(args []reflect.Value) []reflect.Value {
43 c <- true
44 return nil
45 }).Interface().(func())
46 go g()
47 }
48 for i := 0; i < N*2; i++ {
49 <-c
50 }
51 }
52
View as plain text