diff --git a/servant/libservant/EndpointManager.cpp b/servant/libservant/EndpointManager.cpp index 14a07f0..a34e81d 100644 --- a/servant/libservant/EndpointManager.cpp +++ b/servant/libservant/EndpointManager.cpp @@ -1826,8 +1826,8 @@ void EndpointThread::getEndpoints(vector &activeEndPoint, vector lock(_mutex); + // TC_ThreadLock::Lock lock(_mutex); refreshReg(_type,_name); @@ -1846,7 +1846,7 @@ void EndpointThread::getTCEndpoints(vector &activeEndPoint, vector< { - TC_ThreadLock::Lock lock(_lock); + TC_LockT lock(_mutex); refreshReg(_type,_name); @@ -1859,7 +1859,7 @@ void EndpointThread::notifyEndpoints(const set & active, const set { if(!bSync) { - TC_ThreadLock::Lock lock(_lock); + TC_LockT lock(_mutex); update(active, inactive); } @@ -1975,7 +1975,7 @@ void EndpointManagerThread::getTCEndpointByStation(const string sName, vector lock(_mutex); string sAllName = TC_Common::tostr((int)type) + ":" + sName; diff --git a/servant/servant/EndpointManager.h b/servant/servant/EndpointManager.h index 9d1eb2a..70b7601 100644 --- a/servant/servant/EndpointManager.h +++ b/servant/servant/EndpointManager.h @@ -17,6 +17,7 @@ #ifndef __TARS_ENDPOINT_MANAGER_H_ #define __TARS_ENDPOINT_MANAGER_H_ +#include "util/tc_spin_lock.h" #include "util/tc_consistent_hash_new.h" #include "servant/EndpointInfo.h" #include "servant/EndpointF.h" @@ -362,7 +363,8 @@ private: /* * 根据hash值选取一个结点 */ - AdapterProxy* getHashProxy(int64_t hashCode, bool bConsistentHash = false); + AdapterProxy* getHashProxy(int64_t hashCode, bool bConsistentHash = false); + /* * 根据hash值按取模方式,从正常节点中选取一个结点 @@ -585,7 +587,8 @@ private: /* * 锁 */ - TC_ThreadLock _lock; + // TC_ThreadLock _mutex; + TC_SpinLock _mutex; /* @@ -680,7 +683,8 @@ private: /* * 锁 */ - TC_ThreadLock _lock; + // TC_ThreadLock _mutex; + TC_SpinLock _mutex; /* * 保存对象的map