signal

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2025 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package signal implements a run.GroupService handling incoming unix signals.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// RefreshCallback is called when a syscall.SIGHUP is received.
	// If the callback returns an error, the signal handler is stopped. In a
	// run.Group environment this means the entire run.Group is requested to
	// stop.
	RefreshCallback func() error
	// contains filtered or unexported fields
}

Handler implements a unix signal handler as run.GroupService.

func (*Handler) Name

func (h *Handler) Name() string

Name implements run.Unit.

func (*Handler) PreRun

func (h *Handler) PreRun() error

PreRun implements run.PreRunner to initialize the handler.

func (*Handler) ServeContext

func (h *Handler) ServeContext(ctx context.Context) error

ServeContext implements run.ServiceContext and listens for incoming unix signals. If a callback handler was registered it will be executed if a "SIGHUP" is received. If the callback handler returns an error it will exit in error and initiate Group shutdown if used in a run.Group environment.

Jump to

Keyboard shortcuts

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