workerpool

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2021 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WorkerFunc

type WorkerFunc func(workerID int, jobData interface{})

WorkerFunc is a function to perform a single worker job.

type WorkerPool

type WorkerPool struct {
	// contains filtered or unexported fields
}

WorkerPool is a structure to run a pool of worker goroutines, gracefully handling interrupt and termination signals.

func New

func New(size int) *WorkerPool

New returns a new WorkerPool ready-to-use.

func (*WorkerPool) PublishJobData

func (wp *WorkerPool) PublishJobData(jobData interface{})

PublishJobData adds some data to be processed by the workers.

func (*WorkerPool) Run

func (wp *WorkerPool) Run(workerFunc WorkerFunc)

Run runs all workers and blocks until a signal is received.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL