workerpool

package
v0.0.0-...-4d64e5c Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

type Dispatcher struct {
	WorkerPool chan chan Job
	WorkerList []*Worker
	JobQueue   chan Job
	// contains filtered or unexported fields
}

func NewDispatcher

func NewDispatcher(maxWaitingJobs int, maxWorkers int) *Dispatcher

func (*Dispatcher) AddWorker

func (d *Dispatcher) AddWorker(handler JobHandler)

func (*Dispatcher) Dispatch

func (d *Dispatcher) Dispatch()

func (*Dispatcher) Queue

func (d *Dispatcher) Queue(job Job)

func (*Dispatcher) Run

func (d *Dispatcher) Run()

func (*Dispatcher) Stop

func (d *Dispatcher) Stop()

type Job

type Job interface{}

type JobHandler

type JobHandler func(w *Worker, j Job)

type Worker

type Worker struct {
	Id         int
	WorkerPool chan chan Job
	JobChannel chan Job

	Args interface{}
	// contains filtered or unexported fields
}

func (*Worker) Run

func (w *Worker) Run()

func (*Worker) Stop

func (w *Worker) Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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