summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/config/Make.rules11
-rw-r--r--cpp/include/Ice/Config.h3
-rw-r--r--cpp/include/IceUtil/Cond.h3
-rw-r--r--cpp/include/IceUtil/Monitor.h2
-rw-r--r--cpp/src/Ice/Connection.cpp13
-rw-r--r--cpp/src/Ice/Network.cpp12
-rw-r--r--cpp/src/IceUtil/Cond.cpp18
-rw-r--r--cpp/src/IceUtil/RecMutex.cpp17
-rw-r--r--cpp/test/IceUtil/thread/AliveTest.cpp18
9 files changed, 79 insertions, 18 deletions
diff --git a/cpp/config/Make.rules b/cpp/config/Make.rules
index f76e852eb8e..c06a7415986 100644
--- a/cpp/config/Make.rules
+++ b/cpp/config/Make.rules
@@ -59,6 +59,13 @@ prefix = /opt/Ice-$(VERSION)
#OPENSSL_HOME ?= /opt/openssl
#
+# Define if your OpenSSL requires Kerberos, and if Kerberos is not
+# installed in a standard location.
+#
+
+KERBEROS_HOME ?= /usr/kerberos
+
+#
# If Xerces-C++ is not installed in a standard location where the
# compiler can find it, set XERCESC_HOME to the Xerces-C++
# installation directory.
@@ -136,6 +143,10 @@ else
OPENSSL_LIBS = -lssl -lcrypto
endif
+ifneq ($(KERBEROS_HOME),)
+ OPENSSL_FLAGS += -I$(KERBEROS_HOME)/include
+endif
+
ifneq ($(DB_HOME),)
DB_FLAGS = -I$(DB_HOME)/include
DB_LIBS = -L$(DB_HOME)/lib -ldb
diff --git a/cpp/include/Ice/Config.h b/cpp/include/Ice/Config.h
index 6f73221b81c..a1211c23f8f 100644
--- a/cpp/include/Ice/Config.h
+++ b/cpp/include/Ice/Config.h
@@ -73,7 +73,6 @@ typedef double Double;
// TODO: Should not be inline, this is not performance critical.
inline int getSystemErrno() { return GetLastError(); }
inline int getSocketErrno() { return WSAGetLastError(); }
-inline int getDNSErrno() { return WSAGetLastError(); }
#elif (defined(__linux__) || defined(__FreeBSD__)) && defined(i386) || defined (__sun)
@@ -104,8 +103,6 @@ typedef double Double;
// TODO: Should not be inline, this is not performance critical.
inline int getSystemErrno() { return errno; }
inline int getSocketErrno() { return errno; }
-extern int h_errno;
-inline int getDNSErrno() { return h_errno; }
#else
diff --git a/cpp/include/IceUtil/Cond.h b/cpp/include/IceUtil/Cond.h
index 1ce92ae9dea..582d4f9bdde 100644
--- a/cpp/include/IceUtil/Cond.h
+++ b/cpp/include/IceUtil/Cond.h
@@ -313,7 +313,7 @@ Cond::timedWaitImpl(const M& mutex, const Time& timeout) const
timeval tv = Time::now() + timeout;
timespec ts;
ts.tv_sec = tv.tv_sec;
- ts.tv_nsec = tv.tv_usec*1000;
+ ts.tv_nsec = tv.tv_usec * 1000;
int rc = pthread_cond_timedwait(&_cond, state.mutex, &ts);
mutex.lock(state);
@@ -331,6 +331,7 @@ Cond::timedWaitImpl(const M& mutex, const Time& timeout) const
}
return true;
}
+
#endif
} // End namespace IceUtil
diff --git a/cpp/include/IceUtil/Monitor.h b/cpp/include/IceUtil/Monitor.h
index c06d99ca2df..9b06456bc2d 100644
--- a/cpp/include/IceUtil/Monitor.h
+++ b/cpp/include/IceUtil/Monitor.h
@@ -112,6 +112,7 @@ IceUtil::Monitor<T>::unlock() const
notifyImpl(_nnotify);
}
_mutex.unlock();
+
/*
int nnotify = _nnotify;
if(_mutex.unlock())
@@ -160,6 +161,7 @@ IceUtil::Monitor<T>::wait() const
_nnotify = 0;
throw;
}
+
_nnotify = 0;
}
diff --git a/cpp/src/Ice/Connection.cpp b/cpp/src/Ice/Connection.cpp
index c26a7258c03..4f88a116b28 100644
--- a/cpp/src/Ice/Connection.cpp
+++ b/cpp/src/Ice/Connection.cpp
@@ -105,10 +105,17 @@ IceInternal::Connection::waitUntilFinished()
while(_transceiver || _dispatchCount > 0)
{
- if(timedWait(IceUtil::Time::milliSeconds(_endpoint->timeout())))
+ if(_endpoint->timeout() >= 0)
{
- setState(StateClosed, CloseTimeoutException(__FILE__, __LINE__));
- // No return here, we must still wait until _transceiver becomes null.
+ if(!timedWait(IceUtil::Time::milliSeconds(_endpoint->timeout())))
+ {
+ setState(StateClosed, CloseTimeoutException(__FILE__, __LINE__));
+ // No return here, we must still wait until _transceiver becomes null.
+ }
+ }
+ else
+ {
+ wait();
}
}
diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp
index 8809debefba..1f838c8de96 100644
--- a/cpp/src/Ice/Network.cpp
+++ b/cpp/src/Ice/Network.cpp
@@ -627,7 +627,11 @@ IceInternal::getAddress(const string& host, int port, struct sockaddr_in& addr)
if(!entry)
{
DNSException ex(__FILE__, __LINE__);
- ex.error = getDNSErrno();
+#ifdef _WIN32
+ ex.error = WSAGetLastError();
+#else
+ ex.error = h_errno;
+#endif
ex.host = host;
throw ex;
}
@@ -666,7 +670,11 @@ IceInternal::getLocalHost(bool numeric)
if(!entry)
{
DNSException ex(__FILE__, __LINE__);
- ex.error = getDNSErrno();
+#ifdef _WIN32
+ ex.error = WSAGetLastError();
+#else
+ ex.error = h_errno;
+#endif
ex.host = host;
throw ex;
}
diff --git a/cpp/src/IceUtil/Cond.cpp b/cpp/src/IceUtil/Cond.cpp
index 24ab3bd414d..29b76783186 100644
--- a/cpp/src/IceUtil/Cond.cpp
+++ b/cpp/src/IceUtil/Cond.cpp
@@ -200,7 +200,23 @@ IceUtil::Cond::timedDowait(const Time& timeout) const
IceUtil::Cond::Cond()
{
- int rc = pthread_cond_init(&_cond, 0);
+ int rc;
+
+ pthread_condattr_t attr;
+
+ rc = pthread_condattr_init(&attr);
+ if(rc != 0)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__);
+ }
+
+ rc = pthread_cond_init(&_cond, &attr);
+ if(rc != 0)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__);
+ }
+
+ rc = pthread_condattr_destroy(&attr);
if(rc != 0)
{
throw ThreadSyscallException(__FILE__, __LINE__);
diff --git a/cpp/src/IceUtil/RecMutex.cpp b/cpp/src/IceUtil/RecMutex.cpp
index d20486c3a34..a6e75363afe 100644
--- a/cpp/src/IceUtil/RecMutex.cpp
+++ b/cpp/src/IceUtil/RecMutex.cpp
@@ -91,7 +91,9 @@ IceUtil::RecMutex::RecMutex() :
int rc;
#if _POSIX_VERSION >= 199506L
+
pthread_mutexattr_t attr;
+
rc = pthread_mutexattr_init(&attr);
if(rc != 0)
{
@@ -103,10 +105,15 @@ IceUtil::RecMutex::RecMutex() :
{
throw ThreadSyscallException(__FILE__, __LINE__);
}
+
#elif defined(__linux__)
+
const pthread_mutexattr_t attr = { PTHREAD_MUTEX_RECURSIVE_NP };
+
#else
+
const pthread_mutexattr_t attr = { PTHREAD_MUTEX_RECURSIVE };
+
#endif
rc = pthread_mutex_init(&_mutex, &attr);
@@ -114,6 +121,16 @@ IceUtil::RecMutex::RecMutex() :
{
throw ThreadSyscallException(__FILE__, __LINE__);
}
+
+#if _POSIX_VERSION >= 199506L
+
+ rc = pthread_mutexattr_destroy(&attr);
+ if(rc != 0)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__);
+ }
+
+#endif
}
IceUtil::RecMutex::~RecMutex()
diff --git a/cpp/test/IceUtil/thread/AliveTest.cpp b/cpp/test/IceUtil/thread/AliveTest.cpp
index 6757406b3cf..4a7667dc496 100644
--- a/cpp/test/IceUtil/thread/AliveTest.cpp
+++ b/cpp/test/IceUtil/thread/AliveTest.cpp
@@ -13,9 +13,6 @@
// **********************************************************************
#include <IceUtil/IceUtil.h>
-
-#include <stdio.h>
-
#include <AliveTest.h>
#include <TestCommon.h>
@@ -24,17 +21,19 @@ using namespace IceUtil;
static const string createTestName("thread alive");
-class CondVar : public IceUtil::Monitor<IceUtil::Mutex>
+class CondVar : public IceUtil::Monitor<IceUtil::RecMutex>
{
public:
- CondVar() : _done(false)
+
+ CondVar() :
+ _done(false)
{
}
void waitForSignal()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
- while (!_done)
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock lock(*this);
+ while(!_done)
{
wait();
}
@@ -42,18 +41,20 @@ public:
void signal()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this);
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock lock(*this);
_done = true;
notify();
}
private:
+
bool _done;
};
class AliveTestThread : public Thread
{
public:
+
AliveTestThread(CondVar& childCreated, CondVar& parentReady) :
_childCreated(childCreated), _parentReady(parentReady)
{
@@ -72,6 +73,7 @@ public:
}
private:
+
CondVar& _childCreated;
CondVar& _parentReady;
};