mirror of
https://github.com/duanhf2012/origin.git
synced 2026-03-12 11:07:53 +08:00
实时检测module释放
This commit is contained in:
@@ -270,13 +270,14 @@ func (slf *BaseModule) RunModule(module IModule) {
|
|||||||
slf.WaitGroup.Add(1)
|
slf.WaitGroup.Add(1)
|
||||||
defer slf.WaitGroup.Done()
|
defer slf.WaitGroup.Done()
|
||||||
for {
|
for {
|
||||||
|
if atomic.LoadInt32(&slf.corouterstatus) != 0 {
|
||||||
|
module.OnEndRun()
|
||||||
|
GetLogger().Printf(LEVER_INFO, "OnEndRun module %T ...", module)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
//每500ms检查退出
|
//每500ms检查退出
|
||||||
if timer.CheckTimeOut() {
|
if timer.CheckTimeOut() {
|
||||||
if atomic.LoadInt32(&slf.corouterstatus) != 0 {
|
|
||||||
module.OnEndRun()
|
|
||||||
GetLogger().Printf(LEVER_INFO, "OnEndRun module %T ...", module)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-slf.ExitChan:
|
case <-slf.ExitChan:
|
||||||
|
|||||||
Reference in New Issue
Block a user