Run interrupt handlers in lifo order.

This commit is contained in:
Owain G. Ainsworth 2013-12-10 19:46:32 +00:00
parent 2a554c43b0
commit 7df65008be

View file

@ -28,7 +28,10 @@ func mainInterruptHandler() {
select {
case <-interruptChannel:
btcdLog.Infof("Received SIGINT (Ctrl+C). Shutting down...")
for _, callback := range interruptCallbacks {
// run handlers in LIFO order.
for i := range interruptCallbacks {
idx := len(interruptCallbacks) -1 -i
callback := interruptCallbacks[idx]
callback()
}