程序意外退出时关闭sqlite指针

This commit is contained in:
GoEdgeLab
2022-03-14 11:47:34 +08:00
parent 9a6a491817
commit 6436ba503b
7 changed files with 72 additions and 13 deletions

View File

@@ -1,6 +1,7 @@
package events
import (
teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
"sync"
)
@@ -59,6 +60,14 @@ func Remove(key interface{}) {
// Notify 通知事件
func Notify(event Event) {
// 特殊事件
switch event {
case EventQuit:
teaconst.IsQuiting = true
case EventTerminated:
teaconst.IsQuiting = true
}
locker.Lock()
m := eventsMap[event]
locker.Unlock()