core: go.gazette.dev/core/task Index | Files

package task

import "go.gazette.dev/core/task"

Index

Package Files

group.go

type Group Uses

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

Group is a group of tasks which should each be executed concurrently, and which should be collectively blocked on until all are complete. Tasks should be preemptable, and the first task to return a non-nil error cancels the entire Group. While Group is used to invoke and wait on multiple goroutines, it is not itself thread-safe.

func NewGroup Uses

func NewGroup(ctx context.Context) *Group

NewGroup returns a new, empty Group with the given Context.

func (*Group) Cancel Uses

func (g *Group) Cancel()

Cancel the Group Context.

func (*Group) Context Uses

func (g *Group) Context() context.Context

Context returns the Group Context.

func (*Group) GoRun Uses

func (g *Group) GoRun()

GoRun all queued functions. GoRun may be called only once: the second invocation will panic.

func (*Group) Queue Uses

func (g *Group) Queue(desc string, fn func() error)

Queue a function for execution with the Group. Cannot be called after GoRun is invoked or Queue panics.

func (*Group) Wait Uses

func (g *Group) Wait() error

Wait for started functions, returning only after all complete. The first encountered non-nil error is returned. GoRun must have been called or Wait panics.

Package task imports 4 packages (graph) and is imported by 25 packages. Updated 2020-08-25. Refresh now. Tools for package owners.