parallelwork

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackFunc

type CallbackFunc func() error

CallbackFunc is a callback function

type Queue

type Queue struct {
	ProgressCallback func(enqueued, active, completed int64)
	// contains filtered or unexported fields
}

Queue represents a work queue with multiple parallel workers.

func NewQueue

func NewQueue() *Queue

NewQueue returns new parallel work queue.

func (*Queue) EnqueueBack

func (v *Queue) EnqueueBack(callback CallbackFunc)

EnqueueBack adds the work to the back of the queue.

func (*Queue) EnqueueFront

func (v *Queue) EnqueueFront(callback CallbackFunc)

EnqueueFront adds the work to the front of the queue.

func (*Queue) Process

func (v *Queue) Process(workers int) error

Process starts N workers, which will be processing elements in the queue until the queue is empty and all workers are idle.

Jump to

Keyboard shortcuts

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