gopool

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSubmitTimeout    = errors.New("submit error: timed out")
	ErrOptionsDeadQueue = errors.New("options error:dead queue configuration")
	ErrOptionsSpawn     = errors.New("options error:spawn > workers")
)

Functions

This section is empty.

Types

type Option

type Option func(opts *Options)

func WithPanicHandler

func WithPanicHandler(panicHandler func(err interface{})) Option

WithPanicHandler set panicHandler

func WithQueueLength

func WithQueueLength(length int) Option

WithQueueLength set queue length

func WithSpawnSize

func WithSpawnSize(size int) Option

WithSpawnSize set spawn size

type Options

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

type Pool

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

Pool goroutine pool

func NewPool

func NewPool(size int, opts ...Option) (*Pool, error)

func (*Pool) ActiveWorkerNum

func (p *Pool) ActiveWorkerNum() int

ActiveWorkerNum get active worker number

func (*Pool) QueueLength

func (p *Pool) QueueLength() int

QueueLength get queue item number

func (*Pool) Submit

func (p *Pool) Submit(task func()) error

Submit _

func (*Pool) SubmitTimeout

func (p *Pool) SubmitTimeout(timeout time.Duration, task func()) error

SubmitTimeout _

Jump to

Keyboard shortcuts

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