routine

package
v1.1.0-beta Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunSync

func RunSync(ctx context.Context, prob *Routine, f func(ctx context.Context)) bool

func WrapCloser

func WrapCloser(pb *Routine) closes.WithContextCloser

Types

type Routine

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

a easy manager go routine based on goroutine

func New

func New(f func(ctx context.Context)) *Routine

func (*Routine) IsRunning

func (r *Routine) IsRunning() bool

func (*Routine) IsStopped

func (r *Routine) IsStopped() bool

func (*Routine) Running

func (r *Routine) Running() <-chan struct{}

func (*Routine) Start

func (r *Routine) Start() bool

func (*Routine) Stop

func (r *Routine) Stop()

func (*Routine) StopAccepted

func (r *Routine) StopAccepted() bool

func (*Routine) StopAndWait

func (r *Routine) StopAndWait(ctx context.Context) error

func (*Routine) StopAndWaitDuration

func (r *Routine) StopAndWaitDuration(duration time.Duration) error

func (*Routine) Stopped

func (r *Routine) Stopped() chan struct{}

Jump to

Keyboard shortcuts

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