race

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, timeout time.Duration, tasks ...Task) error

Run runs each task in its own go routine and returns the result of the first task to complete (or error). A timeout is specified to limit the whole process. Each task should observe the context and return once the context is done.

Types

type Task

type Task func(ctx context.Context) error

Task is a function which performs some kind of activity and returns an error value. It also observes the given context and, once the context is done, terminates the action and returns (the returned error is ignored in this case).

Jump to

Keyboard shortcuts

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