2014-04-26 09:18:56 +00:00
|
|
|
package Shutdown
|
|
|
|
|
2014-10-19 17:19:11 +00:00
|
|
|
import (
|
|
|
|
"container/list"
|
|
|
|
"os"
|
|
|
|
"os/signal"
|
|
|
|
)
|
2014-04-26 09:18:56 +00:00
|
|
|
|
2014-09-13 10:56:35 +00:00
|
|
|
func init() {
|
2014-04-26 09:18:56 +00:00
|
|
|
shutdownHandlers = list.New()
|
2014-09-13 10:56:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func InitShutdown() {
|
2014-04-26 09:18:56 +00:00
|
|
|
|
|
|
|
// Apply the shutdown handler:
|
|
|
|
signal.Notify(shutdownSignal, os.Interrupt, os.Kill)
|
|
|
|
go executeShutdown()
|
|
|
|
}
|