go issue25897b 源码

  • 2022-07-15
  • 浏览 (805)

golang issue25897b 代码

文件路径:/test/fixedbugs/issue25897b.go

// run

// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Make sure the runtime can scan args of an unstarted goroutine
// which starts with a reflect-generated function.

package main

import (
	"reflect"
	"runtime"
)

const N = 100

type T struct {
}

func (t *T) Foo(c chan bool) {
	c <- true
}

func main() {
	t := &T{}
	runtime.GOMAXPROCS(1)
	c := make(chan bool, N)
	for i := 0; i < N; i++ {
		f := reflect.ValueOf(t).MethodByName("Foo").Interface().(func(chan bool))
		go f(c)
	}
	runtime.GC()
	for i := 0; i < N; i++ {
		<-c
	}
}

相关信息

go 源码目录

相关文章

go bug000 源码

go bug002 源码

go bug003 源码

go bug004 源码

go bug005 源码

go bug006 源码

go bug007 源码

go bug008 源码

go bug009 源码

go bug010 源码

0  赞