activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r956580 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/locks/ReentrantLock.cpp
Date Mon, 21 Jun 2010 13:37:16 GMT
Author: tabish
Date: Mon Jun 21 13:37:15 2010
New Revision: 956580

URL: http://svn.apache.org/viewvc?rev=956580&view=rev
Log:
fix for: https://issues.apache.org/activemq/browse/AMQCPP-295

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/locks/ReentrantLock.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/locks/ReentrantLock.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/locks/ReentrantLock.cpp?rev=956580&r1=956579&r2=956580&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/locks/ReentrantLock.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/locks/ReentrantLock.cpp
Mon Jun 21 13:37:15 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;
 }
 



Mime
View raw message