問題描述兩個goroutine,一個goroutine中做鍵盤的輸入,另一個goroutine做其它數(shù)據(jù)處理。運(yùn)行后,如果我不輸入數(shù)據(jù),另一個goroutine也停止運(yùn)行了。也沒調(diào)度。我希望即使我不輸入數(shù)據(jù),也不要影響另一個goroutine。問題出現(xiàn)的環(huán)境背景及自己嘗試過哪些方法相關(guān)代碼//請把代碼文本粘貼到下方(請勿用圖片代替代碼)packagemainimport("fmt""os""bufio""math/rand")funcmain(){msgChan:=make(chanstring)roundChan:=make(chanint)sleepChan:=make(chanbool)goinput(msgChan)goroundNum(roundChan)goScheduler(msgChan,roundChan)
go語言bufio.NewReader(os.Stdin) 阻塞了goroutine調(diào)度,怎么解決?
慕田峪9158850
2019-05-20 10:22:35