gpool

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 10, 2020 License: BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job func()

Job is a function for doing jobs.

type Pool

type Pool struct {
	JobQueue    chan Job
	WorkerQueue chan *Worker
	// contains filtered or unexported fields
}

Pool is goroutine pool config.

func NewPool

func NewPool(numWorkers int, jobQueueLen int) *Pool

NewPool news gotouine pool

func (*Pool) Release

func (p *Pool) Release()

Release release all workers

func (*Pool) Start

func (p *Pool) Start()

Start starts all workers

type Worker

type Worker struct {
	WorkerQueue chan *Worker
	JobChannel  chan Job
	Stop        chan struct{}
}

Worker goroutine struct.

func (*Worker) Start

func (w *Worker) Start()

Start start gotoutine pool.

Jump to

Keyboard shortcuts

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