Skip to content

Latest commit

 

History

History
120 lines (80 loc) · 2.07 KB

DOC.md

File metadata and controls

120 lines (80 loc) · 2.07 KB

sched

import "github.com/fufuok/utils/sched"

Index

type Option

Option is a scheduler option.

type Option func(w *Pool)

func Queues

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

Pool is a worker pool.

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

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()

Generated by gomarkdoc