diff options
author | Anthony Neal <aneal@zeroc.com> | 2002-09-13 16:08:45 +0000 |
---|---|---|
committer | Anthony Neal <aneal@zeroc.com> | 2002-09-13 16:08:45 +0000 |
commit | 13fdf316b7eb18e6d5eb3a4b39a2b6bde2c9dda9 (patch) | |
tree | 55926a6483ad89ea6f10f529016e04ddecf77e5b /cpp/src/IceSSL/OpenSSLPluginI.cpp | |
parent | Now logging uses LoggerUtil. (diff) | |
download | ice-13fdf316b7eb18e6d5eb3a4b39a2b6bde2c9dda9.tar.bz2 ice-13fdf316b7eb18e6d5eb3a4b39a2b6bde2c9dda9.tar.xz ice-13fdf316b7eb18e6d5eb3a4b39a2b6bde2c9dda9.zip |
Modifications required for cleaning up thread-specific error queues.
Diffstat (limited to 'cpp/src/IceSSL/OpenSSLPluginI.cpp')
-rw-r--r-- | cpp/src/IceSSL/OpenSSLPluginI.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/cpp/src/IceSSL/OpenSSLPluginI.cpp b/cpp/src/IceSSL/OpenSSLPluginI.cpp index eb4091026b3..a5aced06898 100644 --- a/cpp/src/IceSSL/OpenSSLPluginI.cpp +++ b/cpp/src/IceSSL/OpenSSLPluginI.cpp @@ -153,6 +153,9 @@ IceSSL::SslLockKeeper::~SslLockKeeper() // PluginI implementation // +IceUtil::Mutex IceSSL::OpenSSLPluginI::_threadIdCacheMutex; +std::vector<unsigned long> IceSSL::OpenSSLPluginI::_threadIdCache; + // // Public Methods // @@ -179,6 +182,7 @@ IceSSL::OpenSSLPluginI::OpenSSLPluginI(const ProtocolPluginFacadePtr& protocolPl IceSSL::OpenSSLPluginI::~OpenSSLPluginI() { + unregisterThreads(); ERR_free_strings(); } @@ -820,3 +824,30 @@ IceSSL::OpenSSLPluginI::loadTempCerts(TempCertificates& tempCerts) iDHP++; } } + +// +// Note: These two methods are used to remember each thread that uses the IceSSL plugin, +// and then clean up the thread-specific error queue on plugin shutdown. +// + +void +IceSSL::OpenSSLPluginI::registerThread() +{ + unsigned long threadID = idFunction(); + + IceUtil::Mutex::Lock sync(_threadIdCacheMutex); + + if(find(_threadIdCache.begin(), _threadIdCache.end(), threadID) == _threadIdCache.end()) + { + _threadIdCache.push_back(threadID); + } +} + +void +IceSSL::OpenSSLPluginI::unregisterThreads() +{ + IceUtil::Mutex::Lock sync(_threadIdCacheMutex); + + for_each(_threadIdCache.begin(), _threadIdCache.end(), ERR_remove_state); +} + |