package
Version:
v1.0.3
Opens a new window with list of versions in this module.
Published: Dec 29, 2022
License: MIT
Opens a new window with license information.
Imports: 7
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
Package graceful has tools for making graceful shutdown.
View Source
var (
ErrCallbackCnt = errors.New("invalid callbacks count, required only start and stop callbacks")
ErrStartFunc = errors.New("invalid start func")
ErrStopFunc = errors.New("invalid stop func")
)
Init subscribes to os signals and registers cancel func and group context.
Register registers some service to listen and its "stop" function.
Wait registers executor for "stop" callbacks and blocks until all registered callbacks will end.
type Callback func() error
Callback is a common function type.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.