您的位置 首页 golang

golang面试题13之什么情况下goroutineshui会放弃执行权

下面的代码会不会卡死?

 package main

import (
"fmt"
" runtime "
)

func main() {
var i byte

go func() {
for i =0; i<= 255; i++{

}
}()
fmt.Println("Dropping mic")

//  Yield execution to force executing other goroutines
runtime.Gosched()
runtime.GC()
fmt.Println("Done")
}



  

文章来源:智云一二三科技

文章标题:golang面试题13之什么情况下goroutineshui会放弃执行权

文章地址:https://www.zhihuclub.com/99570.shtml

关于作者: 智云科技

热门文章

网站地图