concurrency

package
v0.0.0-...-17de600 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2018 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	WorkerStateIdle = 0
	WorkerStateBusy = 1
	WorkerStateQuit = 2
)

Variables

This section is empty.

Functions

func TaskRunPeriodic

func TaskRunPeriodic(f func() time.Duration, task_name string, defaultInterval time.Duration)

Types

type WorkQueue

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

type WorkRequest

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

type Worker

type Worker struct {
	ID     int
	Work   *WorkQueue
	Status int
	Quit   chan bool
	// contains filtered or unexported fields
}

func (*Worker) Busy

func (w *Worker) Busy()

func (*Worker) Idle

func (w *Worker) Idle()

func (*Worker) IsAvailable

func (w *Worker) IsAvailable() bool

func (*Worker) Start

func (w *Worker) Start()

func (*Worker) Stop

func (w *Worker) Stop()

func (*Worker) Unavailable

func (w *Worker) Unavailable()

type WorkersPool

type WorkersPool struct {
	container.Queue

	Quit chan bool
	// contains filtered or unexported fields
}

func (*WorkersPool) Collect

func (wp *WorkersPool) Collect(f func(interface{}) interface{}, params interface{}, delay time.Duration) error

func (*WorkersPool) CollectWithOutput

func (wp *WorkersPool) CollectWithOutput(f func(interface{}) interface{}, params interface{}, delay time.Duration, output chan interface{}) error

func (*WorkersPool) IsEmpty

func (wp *WorkersPool) IsEmpty() bool

func (*WorkersPool) IsFull

func (wp *WorkersPool) IsFull() bool

func (*WorkersPool) Start

func (wp *WorkersPool) Start(nWorkers int, maxBuffer int)

func (*WorkersPool) Stop

func (wp *WorkersPool) Stop()

Jump to

Keyboard shortcuts

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