summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2003-02-22 23:50:41 +0000
committerMarc Laukien <marc@zeroc.com>2003-02-22 23:50:41 +0000
commitfabde9cbe6ec805f31280f75054b311df4f69ab8 (patch)
tree5e4753a6c031ade4d3434b21702e285c06721766 /cpp/src
parentfixed bug with exceptions propagating from ice_response() (diff)
downloadice-fabde9cbe6ec805f31280f75054b311df4f69ab8.tar.bz2
ice-fabde9cbe6ec805f31280f75054b311df4f69ab8.tar.xz
ice-fabde9cbe6ec805f31280f75054b311df4f69ab8.zip
minor
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/IceSSL/OpenSSLPluginI.cpp18
-rw-r--r--cpp/src/IceUtil/RecMutex.cpp5
-rw-r--r--cpp/src/IceUtil/Thread.cpp4
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();