Ocean/Shutdown/Init.go

23 lines
403 B
Go
Raw Permalink Normal View History

package Shutdown
import (
"container/list"
"os"
"os/signal"
)
2015-06-17 15:44:52 +00:00
// Init the package.
func init() {
shutdownHandlers = list.New()
}
2015-06-17 15:44:52 +00:00
// The manual init for the shutdown notify handler.
func InitShutdown() {
// Apply the shutdown handler:
signal.Notify(shutdownSignal, os.Interrupt, os.Kill)
2015-06-17 15:44:52 +00:00
// Start a new thread which waits for the shutdown event:
go executeShutdown()
}