Skip to content
/ exit Public

Send and receive signals that a Go application should exit.

License

Notifications You must be signed in to change notification settings

quells/exit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exit Signals and Notifications

Installation

go get github.com/quells/exit@latest

exit.Signal{}

Safely close a channel from multiple goroutines to send a signal exactly once. Designed for synchronizing graceful shutdown of multiple HTTP servers in the same Go process.

exit.Notification()

Returns a channel which yields OS-level interrupt or termination signals.

select {
case sig := <-exit.Notification():
    log.Printf("received exit signal %v; will now exit", sig)
}

// <CTRL-C>
// TIMESTAMP: received exit signal interrupt; will now exit

About

Send and receive signals that a Go application should exit.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages