Documentation ¶
Overview ¶
package gqueue 通过指定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 (q *Queue) SetFinishedCallback(callback func())
SetFinishedCallback 所有任务完成后,回调函数
func (*Queue) SetTaskCallback ¶
func (q *Queue) SetTaskCallback(callback func(res interface{}))
SetTaskCallback 设置单个任务执行后的回调函数
Click to show internal directories.
Click to hide internal directories.