Documentation
¶
Index ¶
- func AddJob(spec string, cmd func()) error
- func CancelContext()
- func Context() context.Context
- func GetContextWithCancel() (context.Context, context.CancelFunc)
- func GracefulShutdown()
- func RegisterHook(name string, cb func()) context.Context
- func SetLogger(logger_ Logger)
- func WaitForShutdown(d ...int)
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetContextWithCancel ¶
func GetContextWithCancel() (context.Context, context.CancelFunc)
func GracefulShutdown ¶ added in v0.2.0
func GracefulShutdown()
GracefulShutdown 优雅关闭应用程序,等待所有hook完成并退出
func RegisterHook ¶
RegisterHook 注册系统退出的hook
func WaitForShutdown ¶
func WaitForShutdown(d ...int)
WaitForShutdown 阻塞等待关闭信号
如果传入d, 视为等待d秒结束 如果没有传值, 则默认为等待信号
Types ¶
Click to show internal directories.
Click to hide internal directories.