mirror of
https://github.com/duanhf2012/origin.git
synced 2026-05-18 23:17:30 +08:00
修改动态加载module出现锁被重置
This commit is contained in:
@@ -51,7 +51,7 @@ type BaseModule struct {
|
|||||||
CurrMaxModuleId uint32
|
CurrMaxModuleId uint32
|
||||||
corouterstatus int32 //0表示运行状态 //1释放消亡状态
|
corouterstatus int32 //0表示运行状态 //1释放消亡状态
|
||||||
|
|
||||||
rwModuleLocker *sync.RWMutex
|
rwModuleLocker *sync.Mutex
|
||||||
ExitChan chan bool
|
ExitChan chan bool
|
||||||
WaitGroup *sync.WaitGroup
|
WaitGroup *sync.WaitGroup
|
||||||
bInit bool
|
bInit bool
|
||||||
@@ -71,7 +71,7 @@ func (slf *BaseModule) GetRoot() IModule {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (slf *BaseModule) getLocker() *sync.RWMutex {
|
func (slf *BaseModule) getLocker() *sync.Mutex {
|
||||||
return slf.rwModuleLocker
|
return slf.rwModuleLocker
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,11 +181,6 @@ func (slf *BaseModule) AddModule(module IModule) uint32 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if slf.IsRoot() {
|
|
||||||
//构建Root结点
|
|
||||||
slf.rwModuleLocker = &sync.RWMutex{}
|
|
||||||
}
|
|
||||||
|
|
||||||
pModule := slf.GetModuleById(module.GetModuleId())
|
pModule := slf.GetModuleById(module.GetModuleId())
|
||||||
if pModule != nil {
|
if pModule != nil {
|
||||||
GetLogger().Printf(LEVER_ERROR, "%T Cannot AddModule %T,moduleid %d is repeat!", slf.GetSelf(), module.GetSelf(), module.GetModuleId())
|
GetLogger().Printf(LEVER_ERROR, "%T Cannot AddModule %T,moduleid %d is repeat!", slf.GetSelf(), module.GetSelf(), module.GetModuleId())
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package service
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"sync"
|
||||||
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -80,5 +81,7 @@ func (slf *BaseService) Init(iservice IService) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
slf.serviceid = InstanceServiceMgr().GenServiceID()
|
slf.serviceid = InstanceServiceMgr().GenServiceID()
|
||||||
|
slf.BaseModule.rwModuleLocker = &sync.Mutex{}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user