signal

package
v1.40.2 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package signal provides a clean signal management foundation for the Hector server. It supports registering callbacks for reload (SIGHUP) and shutdown (SIGINT/SIGTERM) signals.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager provides lifecycle management for OS signals. It listens for signals and invokes registered callbacks.

func New

func New(parent context.Context) *Manager

New creates a new signal Manager. The provided parent context is used for lifecycle management.

func (*Manager) OnReload

func (m *Manager) OnReload(fn func())

OnReload registers a callback to be invoked when SIGHUP is received. Multiple callbacks can be registered; they are called in registration order.

func (*Manager) OnShutdown

func (m *Manager) OnShutdown(fn func())

OnShutdown registers a callback to be invoked when SIGINT or SIGTERM is received. Multiple callbacks can be registered; they are called in registration order.

func (*Manager) Start

func (m *Manager) Start() context.Context

Start begins listening for signals in a background goroutine. Returns a context that will be cancelled on shutdown signals. This method is idempotent; subsequent calls return the same context.

func (*Manager) Stop

func (m *Manager) Stop()

Stop cancels the manager's context and stops signal handling.

func (*Manager) TriggerReload

func (m *Manager) TriggerReload()

TriggerReload manually triggers the reload process.

Jump to

Keyboard shortcuts

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