Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecutionFn ¶
job 执行函数签名
type Job ¶
type Job struct { Descriptor JobDescriptor ExecFn ExecutionFn Args interface{} }
type JobDescriptor ¶
type Result ¶
type Result struct { Value interface{} Error error Descriptor JobDescriptor }
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
WorkerPool is a worker group that runs a number of workers at a configured concurrency.
func NewWorkerPool ¶
func NewWorkerPool(workers int) *WorkerPool
NewWorkerPool initializes a new pool with the given number of Workers.
func (*WorkerPool) AddJob ¶
func (p *WorkerPool) AddJob(jobs ...Job)
func (*WorkerPool) Done ¶
func (p *WorkerPool) Done() <-chan struct{}
func (*WorkerPool) IsFinished ¶
func (p *WorkerPool) IsFinished() bool
func (*WorkerPool) Release ¶
func (p *WorkerPool) Release()
func (*WorkerPool) Results ¶
func (p *WorkerPool) Results() <-chan Result
func (*WorkerPool) Run ¶
func (p *WorkerPool) Run(ctx context.Context)
Click to show internal directories.
Click to hide internal directories.