workpool

package
v0.0.0-...-e86600b Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job func(ctx context.Context)

type Option

type Option func(wp *WorkPool)

func WithConcurrency

func WithConcurrency(concurrency int) Option

WithConcurrency set concurrency

func WithSize

func WithSize(size int) Option

WithSize set size

type WorkPool

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

func NewWorkPool

func NewWorkPool(option ...Option) *WorkPool

NewWorkPool new a work pool.

func (*WorkPool) AddJob

func (wp *WorkPool) AddJob(job Job)

AddJob add a job

func (*WorkPool) Start

func (wp *WorkPool) Start()

Start work pool

func (*WorkPool) Stop

func (wp *WorkPool) Stop()

Stop work pool

Jump to

Keyboard shortcuts

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