pool

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package pool contains a generic worker pool

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 is a generic worker pool using t.PoolData as the datatype

func NewPool

func NewPool(ctx context.Context, ch chan t.PoolData) *Pool

NewPool creates a new Pool

func (*Pool) Cancel

func (p *Pool) Cancel()

Cancel cancels the jobs in the pool

func (*Pool) Start

func (p *Pool) Start(numWorkers int, callback PoolCallback)

Start starts numWorkers number of workers on the pool, each running callback

func (*Pool) Wait

func (p *Pool) Wait()

Wait waits for the pool jobs to complete

type PoolCallback

type PoolCallback func(t.PoolData)

PoolCallback is the data process callback

Jump to

Keyboard shortcuts

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