package rungroup

import "github.com/gohugoio/hugo/common/rungroup"

Index

Types

type Config

type Config[T any] struct {
	NumWorkers int
	Handle     func(context.Context, T) error
}

Config is the configuration for a new Group.

type Group

type Group[T any] interface {
	Enqueue(T) error
	Wait() error
}

Group is a group of workers that can be used to enqueue work and wait for them to finish.

func Run

func Run[T any](ctx context.Context, cfg Config[T]) Group[T]

Run creates a new Group with the given configuration.

Source Files

rungroup.go

Version
v0.144.2 (latest)
Published
Feb 19, 2025
Platform
linux/amd64
Imports
2 packages
Last checked
13 hours ago

Tools for package owners.