signals

package
v0.0.0-...-5af6bcd Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SignalHandlerLoop

func SignalHandlerLoop(log log.Logger, ss ...SignalReceiver)

SignalHandlerLoop blocks until it receives a SIGINT, SIGTERM or SIGQUIT. For SIGINT and SIGTERM, it exits; for SIGQUIT is print a goroutine stack dump.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler handles signals, can be interrupted. On SIGINT or SIGTERM it will exit, on SIGQUIT it will dump goroutine stacks to the Logger.

func NewHandler

func NewHandler(log log.Logger, receivers ...SignalReceiver) *Handler

NewHandler makes a new Handler.

func (*Handler) Loop

func (h *Handler) Loop()

Loop handles signals.

func (*Handler) Stop

func (h *Handler) Stop()

Stop the handler

type SignalReceiver

type SignalReceiver interface {
	Stop() error
}

SignalReceiver represents a subsystem/server/... that can be stopped or queried about the status with a signal

Jump to

Keyboard shortcuts

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