diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/IceSSL/OpenSSLPluginI.cpp | 18 | ||||
-rw-r--r-- | cpp/src/IceUtil/RecMutex.cpp | 5 | ||||
-rw-r--r-- | cpp/src/IceUtil/Thread.cpp | 4 |
3 files changed, 13 insertions, 14 deletions
diff --git a/cpp/src/IceSSL/OpenSSLPluginI.cpp b/cpp/src/IceSSL/OpenSSLPluginI.cpp index 522888a9a5a..0dec2723057 100644 --- a/cpp/src/IceSSL/OpenSSLPluginI.cpp +++ b/cpp/src/IceSSL/OpenSSLPluginI.cpp @@ -114,7 +114,6 @@ namespace IceSSL extern "C" { void lockingCallback(int, int, const char*, int); - unsigned long idFunction(); } @@ -145,25 +144,20 @@ void IceSSL::lockingCallback(int mode, int type, const char *file, int line) } } -unsigned long IceSSL::idFunction() +unsigned long +IceSSL::idFunction() { - unsigned long threadID = 0; - #ifdef _WIN32 - threadID = GetCurrentThreadId(); -#elif _POSIX_THREADS - threadID = pthread_self(); + return static_cast<unsigned long>(GetCurrentThreadId()); #else - #error You must define a method to return the current thread ID. + return static_cast<unsigned long>(pthread_self()); #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); + CRYPTO_set_id_callback(IceSSL::idFunction); + CRYPTO_set_locking_callback(IceSSL::lockingCallback); } IceSSL::SslLockKeeper::~SslLockKeeper() diff --git a/cpp/src/IceUtil/RecMutex.cpp b/cpp/src/IceUtil/RecMutex.cpp index 5ea3bbed165..ae83312043c 100644 --- a/cpp/src/IceUtil/RecMutex.cpp +++ b/cpp/src/IceUtil/RecMutex.cpp @@ -88,7 +88,12 @@ IceUtil::RecMutex::lock(LockState& state) const IceUtil::RecMutex::RecMutex() : _count(0) { +#ifdef __linux__ const pthread_mutexattr_t attr = { PTHREAD_MUTEX_RECURSIVE_NP }; +#else + const pthread_mutexattr_t attr = { PTHREAD_MUTEX_RECURSIVE }; +#endif + int rc = pthread_mutex_init(&_mutex, &attr); if(rc != 0) { diff --git a/cpp/src/IceUtil/Thread.cpp b/cpp/src/IceUtil/Thread.cpp index f071c51c8a1..5aa9a67fb88 100644 --- a/cpp/src/IceUtil/Thread.cpp +++ b/cpp/src/IceUtil/Thread.cpp @@ -34,7 +34,7 @@ IceUtil::ThreadControl::ThreadControl() : } } -IceUtil::ThreadControl::ThreadControl(const HandleWrapperPtr& handle, unsigned id) : +IceUtil::ThreadControl::ThreadControl(const HandleWrapperPtr& handle, unsigned int id) : _handle(handle), _id(id), _detached(false) @@ -175,7 +175,7 @@ IceUtil::Thread::start() // __incRef(); - _handle->handle = (HANDLE)_beginthreadex(0, 0, (unsigned (__stdcall*)(void*))startHook, (LPVOID)this, 0, &_id); + _handle->handle = (HANDLE)_beginthreadex(0, 0, (unsigned int (__stdcall*)(void*))startHook, (LPVOID)this, 0, &_id); if(_handle->handle == 0) { __decRef(); |