context

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	// The new context.
	C context.Context
	// contains filtered or unexported fields
}

func NewGroup

func NewGroup(initial context.Context, rest ...context.Context) *Group

NewGroup creates a new ContextGroup with the given initial context. When all added contexts are complete, cancels the contained context. If the passed contexts are already cancelled, this might return a cancelled group.

func NewTimeoutGroup

func NewTimeoutGroup(d time.Duration, rest ...context.Context) *Group

NewTimeoutGroup creates a new ContextGroup that, when it has no active contexts, expires after the given duration. If the duration is zero/low, this may be expired by the time the caller returns.

func (*Group) Add

func (g *Group) Add(ctx context.Context) bool

Add adds this context to the group. Returns true if this was successful, and false if the group is already complete.

func (*Group) IsDone

func (g *Group) IsDone() bool

IsDone immediately returns whether this group is done.

Jump to

Keyboard shortcuts

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