task

package
v0.0.0-...-ffb6f1e Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

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

Group of tasks

func NewGroup

func NewGroup() *Group

NewGroup instance

func (*Group) Add

func (g *Group) Add(task *Task) bool

Add task

func (*Group) Remove

func (g *Group) Remove(task *Task) bool

Remove task

func (*Group) RunAll

func (g *Group) RunAll() bool

RunAll tasks

func (*Group) StopAll

func (g *Group) StopAll()

StopAll tasks

func (*Group) WaitAll

func (g *Group) WaitAll()

WaitAll tasks to stop

type Task

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

Task abstraction

func NewTask

func NewTask(name string, entry func(*Token), args ...interface{}) *Task

NewTask instance

func (*Task) OnEmergentStop

func (t *Task) OnEmergentStop(cbk func()) *Task

OnEmergentStop callback

func (*Task) Run

func (t *Task) Run()

Run task

func (*Task) Stop

func (t *Task) Stop()

Stop task request

func (*Task) Wait

func (t *Task) Wait()

Wait task to stop

type Token

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

Token control the task

func NewToken

func NewToken(args ...interface{}) *Token

NewToken instance

func (*Token) Args

func (t *Token) Args() []interface{}

Args of the task

func (*Token) IsEmergencyStopRequested

func (t *Token) IsEmergencyStopRequested() bool

IsEmergencyStopRequested for the task

func (*Token) IsStopRequested

func (t *Token) IsStopRequested() bool

IsStopRequested for the task

func (*Token) RequireEmergencyStop

func (t *Token) RequireEmergencyStop() bool

RequireEmergencyStop for the task

func (*Token) RequireStop

func (t *Token) RequireStop() bool

RequireStop for the task

func (*Token) Sleep

func (t *Token) Sleep(sec uint32)

Sleep with alertness

Jump to

Keyboard shortcuts

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