exitctrl

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SignalCtx context.Context = nil

the context to be notified to exit

Functions

func AddExitRoutine

func AddExitRoutine(r ExitRoutine)

func IfNeedToExit

func IfNeedToExit() bool

check if the caller need to exit

func Join

func Join()

main wait loop

func NotifyToExit

func NotifyToExit()

notify the routines to exit

func Prestop

func Prestop()

prestop function

func Register

func Register() error

register to process the exit signal

func RegisterWithDuration

func RegisterWithDuration(duration time.Duration) error

func WaitForSignal

func WaitForSignal(interval time.Duration) bool

wait for the exit signal

Types

type ExitController

type ExitController struct {
	NotifyFlag   bool               // the flag to notify to exit
	JustExitFlag bool               // exit flag
	CancelFn     context.CancelFunc // context cancel function
}

type ExitRoutine

type ExitRoutine func()

Jump to

Keyboard shortcuts

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