coroutines

package
v2.22.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parallel

func Parallel(max int, fns ...func())

func ParallelWait

func ParallelWait(max int, fns ...func())

func Run

func Run(fns ...func())

func Wait

func Wait(fns ...func())

Types

type Worker added in v2.11.0

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

func NewWorker added in v2.11.0

func NewWorker(max int) *Worker

NewWorker creates a new worker for running tasks in parallel. The max parameter specifies the maximum number of goroutines that can run at the same time.

Example:

w := coroutines.NewWorker(10)
defer w.Close()
w.Push(func() {
  // do something
}...)
w.Wait()

func (*Worker) Close added in v2.11.0

func (s *Worker) Close()

func (*Worker) Push added in v2.11.0

func (s *Worker) Push(fns ...func())

func (*Worker) Wait added in v2.11.0

func (s *Worker) Wait()

Jump to

Keyboard shortcuts

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