Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
WorkerPool is a pool of workers that manages a number of goroutines to run some tasks concurrently.
func NewWorkerPool ¶
func NewWorkerPool(threads int) *WorkerPool
NewWorkerPool returns a new worker pool. This call will never block. This function creates a set of <thread> goroutines that watch the list of tasks that the worker pool has been assigned to do.
func (*WorkerPool) Do ¶
func (pool *WorkerPool) Do(fn func())
Do tells the worker pool to start executing a task. This call may block if the workers in the pool are all busy.
func (*WorkerPool) Stop ¶
func (pool *WorkerPool) Stop()
Stop tells the worker pool to stop its goroutines, potentially losing some of its tasks while they are in the queue.
Click to show internal directories.
Click to hide internal directories.