Documentation ¶
Overview ¶
通过指定goroutine个数,实现task queue执行器 提交任务到tash chan中,然后不断从chan中取出task执行 结合官方的sync.WaitGroup计数信号等待执行完毕 go goroutine非抢占式的,通过runtime.Gosched()让出cpu给其他goroutine
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
func (*Queue) SetFinishedCallback ¶
func (this *Queue) SetFinishedCallback(callback func())
所有任务完成后,回调函数
func (*Queue) SetTaskCallback ¶
func (this *Queue) SetTaskCallback(callback func(res interface{}))
设置单个任务执行后的回调函数
Click to show internal directories.
Click to hide internal directories.