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 struct used for managing a pool of worker goroutines.
func New ¶
func New(size int) *WorkerPool
Return a WorkerPool instance with the given number of worker goroutines.
func (*WorkerPool) Go ¶
func (p *WorkerPool) Go(fn func())
Go enqueues the given function onto the queue. Blocks until a worker is available to run the function. Panics if Wait() has already been called.
func (*WorkerPool) Wait ¶
func (p *WorkerPool) Wait()
Wait closes the queue and waits until all workers are finished. The WorkerPool cannot be reused again.
Click to show internal directories.
Click to hide internal directories.