routine

package
v0.0.0-...-7b3ddb2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCancel

func AddCancel(cancel func()) (ctx context.Context)

AddCancel addcancel hook

func AddCloser

func AddCloser(c closeFunc)

AddCloser add close hook

func DebugString

func DebugString() string

DebugString return the debug string

func GoWork

func GoWork(f func())

GoWork execute the f function in a routine, The routine is reused.

func IsStopped

func IsStopped() <-chan struct{}

IsStopped return the service has stopped

func LogPanic

func LogPanic(r interface{})

func RunWork

func RunWork(name string, f func() error, panicHandler ...func(interface{})) error

RunWork run the func in the same routine

func RunWorkAsync

func RunWorkAsync(name string, f func(), panicHandler ...func(interface{})) error

RunWorkAsync run the func in new routine

func RunWorkDaemon

func RunWorkDaemon(name string, f func(), quit <-chan struct{}) error

RunWorkDaemon run the func in new routine and run until stop

func ShouldStop

func ShouldStop() <-chan struct{}

ShouldStop return the service is stopping

func Stop

func Stop() error

Stop stop the service and wait all worker exit

func WorkNum

func WorkNum() int64

WorkNum return current number of works

Types

This section is empty.

Jump to

Keyboard shortcuts

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