問題描述兩個goroutine,一個goroutine中做鍵盤的輸入,另一個goroutine做其它數據處理。運行后,如果我不輸入數據,另一個goroutine也停止運行了。也沒調度。我希望即使我不輸入數據,也不要影響另一個goroutine。問題出現的環境背景及自己嘗試過哪些方法相關代碼//請把代碼文本粘貼到下方(請勿用圖片代替代碼)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調度,怎么解決?
慕田峪9158850
2019-05-20 10:22:35