Run interrupt handlers in lifo order.
This commit is contained in:
parent
2a554c43b0
commit
7df65008be
1 changed files with 4 additions and 1 deletions
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue