优化定时器

This commit is contained in:
boyce
2020-10-28 11:30:22 +08:00
parent 019989fe2c
commit 7de290b553
5 changed files with 24 additions and 17 deletions

View File

@@ -128,11 +128,11 @@ func (slf *Module) ReleaseModule(moduleId int64){
pModule.self.OnRelease()
log.Debug("Release module %s.",slf.GetModuleName())
for pTimer,_ := range pModule.mapActiveTimer {
pTimer.Stop()
pTimer.Close()
}
for pCron,_ := range pModule.mapActiveCron {
pCron.Stop()
pCron.Close()
}
delete(slf.child,moduleId)

View File

@@ -139,7 +139,7 @@ func (slf *Service) Run() {
analyzer = nil
}
case t := <- slf.dispatcher.ChanTimer:
if t.IsStop() == false {
if t.IsClose() == false {
if slf.profiler != nil {
analyzer = slf.profiler.Push(fmt.Sprintf("Timer_%s", t.AdditionData.(*timer.Timer).GetFunctionName()))
}