@
ryanking8215 感觉很奇怪
如下代码,如果是只有一个go func() ,我这里是4个线程,如果有3个 go func(),则变成3个线程
不知道go内部是啥逻辑
func main() {
runtime.GOMAXPROCS(1)
go func() {
time.Sleep(3*time.Second)
fmt.Println("Hello, World. after 3 seconds")
}()
go func() {
time.Sleep(4*time.Second)
fmt.Println("Hello, World. after 4 seconds")
}()
go func() {
time.Sleep(5*time.Second)
fmt.Println("Hello, World. after 5 seconds")
}()
time.Sleep(6*time.Second)
fmt.Println("end")
}