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

This commit is contained in:
刘祥超
2022-03-14 11:47:34 +08:00
parent ce87fa25e7
commit d0b86af4ef
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()