workerpools

package
v0.0.0-...-4cd9d19 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsStop

func IsStop() bool

func OnInit

func OnInit(s core.IService, opt ...Option) (err error)

func Stop

func Stop()

func StopWait

func StopWait()

func Submit

func Submit(task func(ctx context.Context, cancel context.CancelFunc))

func SubmitWait

func SubmitWait(task func(ctx context.Context, cancel context.CancelFunc))

func WaitingQueueSize

func WaitingQueueSize() int

Types

type IWorkerPool

type IWorkerPool interface {
	Stop()
	StopWait()
	IsStop() bool
	Submit(task func(ctx context.Context, cancel context.CancelFunc))
	SubmitWait(task func(ctx context.Context, cancel context.CancelFunc))
	WaitingQueueSize() int
}

func NewTaskPools

func NewTaskPools(opt ...Option) (pools IWorkerPool, err error)

type Option

type Option func(*Options)

func SetMaxWorkers

func SetMaxWorkers(v int) Option

func SetTaskTimeOut

func SetTaskTimeOut(v time.Duration) Option

type Options

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

type WorkerPool

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

func (*WorkerPool) IsStop

func (p *WorkerPool) IsStop() bool

func (*WorkerPool) Stop

func (p *WorkerPool) Stop()

func (*WorkerPool) StopWait

func (p *WorkerPool) StopWait()

func (*WorkerPool) Submit

func (p *WorkerPool) Submit(task func(ctx context.Context, cancel context.CancelFunc))

func (*WorkerPool) SubmitWait

func (p *WorkerPool) SubmitWait(task func(ctx context.Context, cancel context.CancelFunc))

func (*WorkerPool) WaitingQueueSize

func (p *WorkerPool) WaitingQueueSize() int

Jump to

Keyboard shortcuts

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