chief

package module
v0.0.0-...-cd0c7f2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2016 License: MIT Imports: 0 Imported by: 2 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

#Chief Build Status Coverage Status

Start workers to handle any kind of data asynchrony.

Checkout example_test.go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chief

type Chief struct {
	Jobs       chan Job
	Pool       PoolChannel
	HandleFunc HandleFunc
	Workers    []Worker
	MaxWorkers int
}

func New

func New(max int, fn HandleFunc) Chief

Create a new dispatcher to handle workers

func (*Chief) Start

func (c *Chief) Start()

Start goroutine to handle jobs

func (Chief) Stop

func (c Chief) Stop()

Stop chief, all workers and all channels

type HandleFunc

type HandleFunc func(Job)

type Job

type Job struct {
	Order interface{}
}

type PoolChannel

type PoolChannel chan chan Job

type Worker

type Worker struct {
	Jobs       chan Job
	Pool       PoolChannel
	HandleFunc HandleFunc
	Quit       chan bool
	QuitDone   chan bool
}

func (Worker) Start

func (w Worker) Start()

func (Worker) Stop

func (w Worker) Stop()

Jump to

Keyboard shortcuts

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