pool

package
v0.0.0-...-ab4a820 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2020 License: Apache-2.0, MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RUNNING = 1
	PAUSED  = 2
	STOPPED = 3
)

Variables

View Source
var (
	// ErrInvalidPoolCap return if pool size <= 0
	ErrInvalidPoolCap = errors.New("invalid pool cap")
	// ErrPoolAlreadyClosed put task but pool already closed
	ErrPoolAlreadyClosed = errors.New("pool already closed")
)

Functions

This section is empty.

Types

type Pool

type Pool struct {
	PanicHandler func(interface{})
	// contains filtered or unexported fields
}

Pool task pool

func NewPool

func NewPool(capacity uint64) (*Pool, error)

NewPool init pool

func (*Pool) Close

func (p *Pool) Close()

Close close pool graceful

func (*Pool) GetCap

func (p *Pool) GetCap() uint64

GetCap get capacity

func (*Pool) GetRunningWorkers

func (p *Pool) GetRunningWorkers() uint64

GetRunningWorkers get running workers

func (*Pool) Put

func (p *Pool) Put(task *Task) error

Put put a task to pool

type Task

type Task struct {
	Handler func(v ...interface{})
	Params  []interface{}
}

Task task to-do

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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