concurrencylimiter

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Size int
)

Functions

func Do

func Do(f func() error) error

Do calls f with the limited concurrency.

func Init

func Init(size int, d ...time.Duration)

Init initializes concurrencylimiter.

Init must be called after flag.Parse call.

func ScheduleWork

func ScheduleWork(uw Worker)

ScheduleUnmarshalWork schedules uw to run in the worker pool.

It is expected that StartUnmarshalWorkers is already called.

func StartWorkers

func StartWorkers()

StartWorkers starts unmarshal workers.

func StopWorkers

func StopWorkers()

StopWorkers stops unmarshal workers.

No more calles to ScheduleWork are allowed after calling stopWorkers

Types

type Worker

type Worker interface {
	// Do must implement CPU-bound work.
	Do()
}

Worker is a unit of unmarshal work.

Jump to

Keyboard shortcuts

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