diff options
author | Anthony Neal <aneal@zeroc.com> | 2002-09-06 16:33:43 +0000 |
---|---|---|
committer | Anthony Neal <aneal@zeroc.com> | 2002-09-06 16:33:43 +0000 |
commit | 8204f29f8cd9706297e306d19de89948659034a5 (patch) | |
tree | e53ad55ea4ec56445f82b048a6fe559fe0700b01 /cpp/src/IceSSL/OpenSSLPluginI.cpp | |
parent | fixes (diff) | |
download | ice-8204f29f8cd9706297e306d19de89948659034a5.tar.bz2 ice-8204f29f8cd9706297e306d19de89948659034a5.tar.xz ice-8204f29f8cd9706297e306d19de89948659034a5.zip |
Updated to include thread id callback.
Diffstat (limited to 'cpp/src/IceSSL/OpenSSLPluginI.cpp')
-rw-r--r-- | cpp/src/IceSSL/OpenSSLPluginI.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/cpp/src/IceSSL/OpenSSLPluginI.cpp b/cpp/src/IceSSL/OpenSSLPluginI.cpp index 1116c7405ac..8dd68029d96 100644 --- a/cpp/src/IceSSL/OpenSSLPluginI.cpp +++ b/cpp/src/IceSSL/OpenSSLPluginI.cpp @@ -90,7 +90,9 @@ namespace IceSSL extern "C" { - void lockingCallback(int, int, const char*, int); + static void lockingCallback(int, int, const char*, int); + + static unsigned long idFunction(); } class SslLockKeeper @@ -108,7 +110,7 @@ SslLockKeeper lockKeeper; } -void IceSSL::lockingCallback(int mode, int type, const char *file, int line) +static void IceSSL::lockingCallback(int mode, int type, const char *file, int line) { if(mode & CRYPTO_LOCK) { @@ -120,14 +122,31 @@ void IceSSL::lockingCallback(int mode, int type, const char *file, int line) } } +static unsigned long IceSSL::idFunction() +{ + unsigned long threadID = 0; + +#ifdef WINDOWS + threadID = GetCurrentThreadId(); +#elif _POSIX_THREADS + threadID = pthread_self(); +#else + #error You must define a method to return the current thread ID. +#endif + + return threadID; +} + IceSSL::SslLockKeeper::SslLockKeeper() { + CRYPTO_set_id_callback((unsigned long(*)())IceSSL::idFunction); CRYPTO_set_locking_callback((void (*)(int, int, const char*, int))IceSSL::lockingCallback); } IceSSL::SslLockKeeper::~SslLockKeeper() { - CRYPTO_set_locking_callback(NULL); + CRYPTO_set_locking_callback(0); + CRYPTO_set_id_callback(0); } // |