Documentation
¶
Overview ¶
Package task provides a work pool, for doing many things concurrently.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrPoolBusy = errors.New("task: work not done, pool not free in time")
Functions ¶
This section is empty.
Types ¶
type Task ¶
type Task struct {
// contains filtered or unexported fields
}
Task provides a pool of goroutines for Worker tasks to be submitted.
func (*Task) Do ¶
Do submits work to the pool. An error is returned in the case the pool is saturated with existing work and does not respond before the context is canceled.
type Worker ¶
type Worker interface {
Work()
}
Worker defines the single method necessary to do work in the pool.
type WorkerFunc ¶
type WorkerFunc func()
WorkerFunc is an adapter to allow the use of ordinary functions as Workers. If f is a function with an appropriate signature, WorkerFunc is a Worker which calls f.