Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 63386 invoked from network); 21 Jun 2010 13:38:07 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 21 Jun 2010 13:38:07 -0000 Received: (qmail 52331 invoked by uid 500); 21 Jun 2010 13:38:07 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 52271 invoked by uid 500); 21 Jun 2010 13:38:05 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 52264 invoked by uid 99); 21 Jun 2010 13:38:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Jun 2010 13:38:04 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Jun 2010 13:38:02 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 318592388980; Mon, 21 Jun 2010 13:37:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100621133716.318592388980@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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; }