sighandler

package
v0.0.0-...-7426b64 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pop

func Pop() error

Pop stops and closes the currently active signal handler and removes it from the stack The next signal handler in the stack is resumed

func Push

func Push(s signalStacker)

Push adds a signal handler to the stack of signal handler It stops all signal handlers that are lower in the stack and makes the current one the only active one.

Types

type Awaiting

type Awaiting = sigHandler

Awaiting is a signal handler that is active while waiting for a specific function to finish

func NewAwaitingSigHandler

func NewAwaitingSigHandler(signals ...os.Signal) *Awaiting

NewAwaitingSigHandler constructs a signal handler awaiting a function to return

func (*Awaiting) Close

func (as *Awaiting) Close() error

Close stops the signal handler

func (*Awaiting) WaitForFunc

func (as *Awaiting) WaitForFunc(f func() error) error

WaitForFunc waits for `f` to return, unless a signal on the sigCh is received. In that case, we return a SignalError.

type Background

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

Background listens for signals in the background

func NewBackgroundSignalHandler

func NewBackgroundSignalHandler(callback func(os.Signal), signals ...os.Signal) *Background

NewBackgroundSignalHandler constructs a signal handler that processes signals in the background until stopped or closed

func (*Background) Close

func (bs *Background) Close() error

Close cancels the background process

func (Background) Pause

func (sh Background) Pause()

func (Background) Resume

func (sh Background) Resume()

type SignalError

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

SignalError is returned by the AwaitingSigHandler if an interrupt signal was received

func (SignalError) Error

func (se SignalError) Error() string

Error returns an message about the received event

func (SignalError) Signal

func (se SignalError) Signal() os.Signal

Signal returns the received signal

Jump to

Keyboard shortcuts

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