qroutine

package
v0.0.0-...-4155a33 Latest Latest
Warning

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

Go to latest
Published: May 26, 2020 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(timeout time.Duration, boxes ...*Box)

timeout < 0 no wait, timeout == 0 wait until all done

Types

type Box

type Box struct {
	Arg     interface{}
	Routine SimpleRoutine
	// contains filtered or unexported fields
}

func NewBox

func NewBox(routine SimpleRoutine, arg interface{}) *Box

func (*Box) GetResult

func (o *Box) GetResult() (interface{}, error)

func (*Box) GetState

func (o *Box) GetState() BoxState

func (*Box) Go

func (o *Box) Go()

type BoxState

type BoxState int
const (
	PENDING BoxState = iota
	RUNNING
	FINISH
	ERROR
)

type SimpleRoutine

type SimpleRoutine func(arg interface{}) interface{}

type Timer

type Timer struct {
	Context interface{}
	// contains filtered or unexported fields
}

func (*Timer) Start

func (o *Timer) Start(delay time.Duration, interval time.Duration, routine TimerRoutine) error

func (*Timer) Stop

func (o *Timer) Stop()

func (*Timer) Wake

func (o *Timer) Wake()

type TimerRoutine

type TimerRoutine func(timer *Timer, err error)

Jump to

Keyboard shortcuts

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