Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithSignal ¶
WithSignal creates a context that will be cancelled if any of the configured signals is received by the process. The signal handler will be removed automatically in case the parent context gets cancelled or when the cancel function is called.
The context should be used to trigger application shutdown. If the signal is received again, the signal handler will force shutdown the process with exit code 3.
example:
func main() { ctx, cancel := osctx.WithSignal(context.Background(), os.Kill) defer cancel() for ctx.Err == nil { // main run loop } }
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.