future

package
v2.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() (*Future, SetFunc)

New constructs new Future.

Use return setter to set value of the future and unblock all routines waiting on the future. The setter will succeed only once, repeated calls of set do nothing.

Types

type Future

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

Thread-safe facility to obtain/wait for a value from a single producer in multiple goroutines

func (*Future) Get

func (f *Future) Get(ctx context.Context) (Value, error)

Get returns value when it is set.

func (*Future) Ready

func (f *Future) Ready() bool

Ready checks whether value is set

type SetFunc

type SetFunc func(Value, error)

type Value

type Value interface{}

Jump to

Keyboard shortcuts

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