mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-04 06:54:45 +08:00
修改动态加载module出现锁被重置
This commit is contained in:
@@ -51,7 +51,7 @@ type BaseModule struct {
|
||||
CurrMaxModuleId uint32
|
||||
corouterstatus int32 //0表示运行状态 //1释放消亡状态
|
||||
|
||||
rwModuleLocker *sync.RWMutex
|
||||
rwModuleLocker *sync.Mutex
|
||||
ExitChan chan bool
|
||||
WaitGroup *sync.WaitGroup
|
||||
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
|
||||
}
|
||||
|
||||
@@ -181,11 +181,6 @@ func (slf *BaseModule) AddModule(module IModule) uint32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
if slf.IsRoot() {
|
||||
//构建Root结点
|
||||
slf.rwModuleLocker = &sync.RWMutex{}
|
||||
}
|
||||
|
||||
pModule := slf.GetModuleById(module.GetModuleId())
|
||||
if pModule != nil {
|
||||
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 (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"reflect"
|
||||
"strings"
|
||||
@@ -80,5 +81,7 @@ func (slf *BaseService) Init(iservice IService) error {
|
||||
}
|
||||
|
||||
slf.serviceid = InstanceServiceMgr().GenServiceID()
|
||||
slf.BaseModule.rwModuleLocker = &sync.Mutex{}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user