yireyun/go-queue

在非循环之中,为什么要用runtime.Gosched()呢?

Closed this issue · 1 comments

比如这段,

if posCnt >= capMod-1 {
	runtime.Gosched()
	return false, posCnt
}

如果Get不到数据,或Pu队列已满,这时需要通知Golang调度其他的Go程,Put放入数据或者Get取走数据。