async

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job sync.WaitGroup

A Job provides a top level API above the sync.WaitGroup.

job := new(async.Job)
for _, action := range jobs {
	job.Do(action, logger)
}
job.Wait()

It looks a little bit similar to the golang.org/x/sync/errgroup.

func (*Job) Do

func (job *Job) Do(action func() error, handler func(error))

Do calls the given function in a new goroutine. If an error is not nil, it passes it to the handler.

func (*Job) Wait

func (job *Job) Wait()

Wait blocks until the sync.WaitGroup counter is zero.

Jump to

Keyboard shortcuts

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