group

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Group package provides a way to manage a group of goroutines.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group added in v0.7.0

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

Group manages the lifetime of a set of goroutines from a common context. The first goroutine in the group to return will cause the context to be canceled, terminating the remaining goroutines.

func New added in v0.7.0

func New(opts ...Opt) *Group

New creates a new group.

func (*Group) Add added in v0.7.0

func (g *Group) Add(fn func(context.Context) error)

Add is adding a new goroutine to the group.

func (*Group) Wait added in v0.7.0

func (g *Group) Wait() error

Wait is a blocking call that waits for all goroutines to exit.

type Opt added in v0.7.0

type Opt func(*Group)

Opt is an option for the routine group

func WithContext added in v0.5.8

func WithContext(ctx context.Context) Opt

WithContext uses the provided context for the group.

Jump to

Keyboard shortcuts

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