sched

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: MIT, GPL-3.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(w *Pool)

Option is a scheduler option.

func Queues added in v0.6.1

func Queues(limit int) Option

Queues is buffer capacity of the tasks channel.

func Workers

func Workers(limit int) Option

Workers is number of workers that can execute tasks concurrently.

type Pool

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

Pool is a worker pool.

func New

func New(opts ...Option) *Pool

New creates a new task scheduler and returns a pool of workers.

func (*Pool) Add

func (p *Pool) Add(numTasks int) int

func (*Pool) IsRunning

func (p *Pool) IsRunning() bool

func (*Pool) Release

func (p *Pool) Release()

func (*Pool) Run

func (p *Pool) Run(f ...func())

Run runs f in the current pool.

func (*Pool) RunWithArgs

func (p *Pool) RunWithArgs(f func(args interface{}), args interface{})

func (*Pool) Running

func (p *Pool) Running() uint64

func (*Pool) Wait

func (p *Pool) Wait()

func (*Pool) WaitAndRelease

func (p *Pool) WaitAndRelease()

Jump to

Keyboard shortcuts

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