signal

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler stores all the required information to gracefully shutdown

func GlobalHandler

func GlobalHandler() *Handler

GlobalHandler will return a singleton to be used throughout the lifetime of the application

func NewHandler

func NewHandler() *Handler

NewHandler returns a new configured handler

func (*Handler) Await

func (h *Handler) Await(ctx context.Context, cancel context.CancelFunc, sigs ...os.Signal)

Await registers a signal handler for all the passed OS signals, awaits either the system signal to be called or for the context to be done the it will issue a shutdown

func (*Handler) Done

func (h *Handler) Done()

Done to be called outside of the

func (*Handler) Finalise

func (h *Handler) Finalise()

Finalise will either recover from a panic or await the shutdown signal to run the final operations Should only be used within the main function as a deferred statement

func (*Handler) Register

func (h *Handler) Register(op func())

Register allows to define what operations need to happen when the system is shutting down. Register doesn't ensure order outside of a single threaded context.

Jump to

Keyboard shortcuts

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