diff options
Diffstat (limited to 'cpp/src/Ice/EndpointI.cpp')
-rw-r--r-- | cpp/src/Ice/EndpointI.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/cpp/src/Ice/EndpointI.cpp b/cpp/src/Ice/EndpointI.cpp index 64c6efa5cf2..9bfa1516065 100644 --- a/cpp/src/Ice/EndpointI.cpp +++ b/cpp/src/Ice/EndpointI.cpp @@ -13,13 +13,50 @@ #include <Ice/Network.h> #include <Ice/PropertiesI.h> #include <Ice/LoggerUtil.h> +#include <IceUtil/MutexPtrLock.h> using namespace std; using namespace IceInternal; +namespace +{ + +IceUtil::Mutex* hashMutex = 0; + +class Init +{ +public: + + Init() + { + hashMutex = new IceUtil::Mutex; + } + + ~Init() + { + delete hashMutex; + hashMutex = 0; + } +}; + +Init init; + +} + Ice::LocalObject* IceInternal::upCast(EndpointI* p) { return p; } IceUtil::Shared* IceInternal::upCast(EndpointHostResolver* p) { return p; } +Ice::Int +IceInternal::EndpointI::ice_getHash() const +{ + IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(hashMutex); + if(!_hashInitialized) + { + _hashValue = hashInit(); + } + return _hashValue; +} + vector<ConnectorPtr> IceInternal::EndpointI::connectors(const vector<struct sockaddr_storage>& addrs) const { @@ -31,6 +68,10 @@ IceInternal::EndpointI::connectors(const vector<struct sockaddr_storage>& addrs) return vector<ConnectorPtr>(); } +IceInternal::EndpointI::EndpointI() : _hashInitialized(false) +{ +} + IceInternal::EndpointHostResolver::EndpointHostResolver(const InstancePtr& instance) : IceUtil::Thread("Ice endpoint host resolver thread"), _instance(instance), |