routinepool

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2015 License: MIT Imports: 2 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 interface{}

type Pool

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

func New

func New(processor func(Job), jobBufsize int, maxIdle, maxActive uint64) *Pool

New create a pool with fix number of goroutine, if maxActive is 0, there is no limit of goroutine number

func (*Pool) Close

func (p *Pool) Close()

Close stop receive new job, and waiting for all exists jobs to be processed

func (*Pool) Do

func (p *Pool) Do(job Job) bool

Do process a job. If there is no goroutine available and goroutine number already reach the limitation, it will blocked untile a goroutine is free. Otherwise create a new goroutine. Return false only if pool already closed

func (*Pool) Info

func (p *Pool) Info() (numIdle, numActive uint64)

Info return current infomation about idle and activing goroutine number of the pool

Jump to

Keyboard shortcuts

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