taskpool

package
v0.0.0-...-2bcc18c Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2017 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TaskPool

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

TaskPool manages concurrent processes. No more than size tasks run at once, and when a task returns an error, the Pool's context is cancelled.

func New

func New(ctx context.Context, size int) (TaskPool, context.Context)

New returns a TaskPool waiting for tasks to run.

func (TaskPool) Go

func (tp TaskPool) Go(t func() error)

Go adds a task to the pool of tasks to complete.

func (TaskPool) Wait

func (tp TaskPool) Wait() error

Wait waits for all tasks added to the pool to finish running.

Jump to

Keyboard shortcuts

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