Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPoolClosed = xerrors.New("pool is closed")
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool interface { // Add puts task into pool and waits until task processing is started. // Error is returned if task cannot be put into pool (ex. pool is closed), not if the processing itself has failed Add(task interface{}) error // Run makes pool ready to accept incoming tasks Run() error // Close stops accepting new tasks and waits until all tasks are processed and free internal pool resources Close() error }
Pool should be used to process set of homogeneous items (called tasks) in parallel
func NewDefaultPool ¶
NewDefaultPool creates simple task pool. taskFn is called to process each task. Capacity sets maximum number of tasks to be processed simultaneously
Click to show internal directories.
Click to hide internal directories.