worker

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2020 License: MIT Imports: 2 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

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

Pool provides a set of workers for executing functions

func NewPool

func NewPool(workers int) *Pool

NewPool creates a pool with the specified number of workers. The pool will not begin accepting jobs until Start() is called.

func (*Pool) Complete

func (p *Pool) Complete() <-chan struct{}

Complete returns a channel that will be closed when all workers have finished

func (*Pool) Enqueue

func (p *Pool) Enqueue(job func() error) error

Enqueue adds a job to the pool.

func (*Pool) Err

func (p *Pool) Err() error

func (*Pool) Start

func (p *Pool) Start()

Start initializes the Pool to begin accepting and running jobs.

func (*Pool) Stop

func (p *Pool) Stop()

Stop prevents this pool from accepting new jobs.

Jump to

Keyboard shortcuts

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