You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2010/06/21 15:41:24 UTC
svn commit: r956587 -
/activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/decaf/util/concurrent/locks/ReentrantLock.cpp
Author: tabish
Date: Mon Jun 21 13:41:23 2010
New Revision: 956587
URL: http://svn.apache.org/viewvc?rev=956587&view=rev
Log:
fix for: https://issues.apache.org/activemq/browse/AMQCPP-295
Modified:
activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/decaf/util/concurrent/locks/ReentrantLock.cpp
Modified: activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/decaf/util/concurrent/locks/ReentrantLock.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/decaf/util/concurrent/locks/ReentrantLock.cpp?rev=956587&r1=956586&r2=956587&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/decaf/util/concurrent/locks/ReentrantLock.cpp (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.2.x/activemq-cpp/src/main/decaf/util/concurrent/locks/ReentrantLock.cpp Mon Jun 21 13:41:23 2010
@@ -473,6 +473,8 @@ long long ConditionObject::awaitNanos( l
lock->lock_count = 0;
lock->lock_owner_tid = 0;
+#ifdef HAVE_PTHREAD_H
+
// Get time now as nanoseconds.
struct timeval tv;
gettimeofday( &tv, NULL );
@@ -486,8 +488,13 @@ long long ConditionObject::awaitNanos( l
abstime.tv_sec = TimeUnit::NANOSECONDS.toSeconds( delay );
abstime.tv_nsec = delay % 1000000000;
-#ifdef HAVE_PTHREAD_H
unsigned int result = pthread_cond_timedwait( &condition, &lock->handle, &abstime );
+
+ if( result != 0 && result != ETIMEDOUT ) {
+ throw RuntimeException(
+ __FILE__, __LINE__, "Failed to wait on OS Condition object." );
+ }
+
#else
#endif
@@ -497,11 +504,6 @@ long long ConditionObject::awaitNanos( l
lock->lock_count = lock_count;
lock->lock_owner_tid = lock_owner_tid;
- if( result != 0 && result != ETIMEDOUT ) {
- throw RuntimeException(
- __FILE__, __LINE__, "Failed to wait on OS Condition object." );
- }
-
return 0;
}