Documentation
¶
Overview ¶
Package workerpool provides an implementation of the worker pool pattern for a configurable number of arbitrary, generic jobs. For details on this pattern, refer to https://gobyexample.com/worker-pools.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WorkerPool ¶
WorkerPool is a generic worker pool representation whose workers process inputs of type J and return outputs of type R.
func New ¶
func New[J any, R any](size int, worker func(jobs <-chan J, results chan<- R)) *WorkerPool[J, R]
New returns a new WorkerPool for workers processing inputs of type J and returning outputs of type R.
func (*WorkerPool[J, R]) Run ¶
func (wp *WorkerPool[J, R]) Run(jobs []J) (results []R)
Run processes jobs in workers processing inputs of type J and returning outputs of type R.
Click to show internal directories.
Click to hide internal directories.