activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nmitt...@apache.org
Subject svn commit: r487918 - in /incubator/activemq/activemq-cpp/trunk/activemq-cpp/src: main/activemq/concurrent/Thread.cpp test/activemq/concurrent/MutexTest.h
Date Sat, 16 Dec 2006 23:49:44 GMT
Author: nmittler
Date: Sat Dec 16 15:49:43 2006
New Revision: 487918

URL: http://svn.apache.org/viewvc?view=rev&rev=487918
Log:
[AMQCPP-27] Updates to thred and MutexTest::test in hopes of removing warning from Valgrind


Modified:
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/concurrent/Thread.cpp
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/concurrent/MutexTest.h

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/concurrent/Thread.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/concurrent/Thread.cpp?view=diff&rev=487918&r1=487917&r2=487918
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/concurrent/Thread.cpp
(original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/concurrent/Thread.cpp
Sat Dec 16 15:49:43 2006
@@ -26,6 +26,7 @@
 #endif
 
 #include <activemq/exceptions/ActiveMQException.h>
+#include <activemq/exceptions/RuntimeException.h>
 
 using namespace activemq;
 using namespace activemq::concurrent;
@@ -160,9 +161,15 @@
     Thread* thread = (Thread*)param;
     
     // Invoke run on the task.
-    thread->task->run();
+    try{
+        thread->task->run();
+    } catch( ... ){
+        exceptions::RuntimeException ex(__FILE__, __LINE__, "unhandled exception bubbled
up to Thread::run");
+        ex.printStackTrace();
+    }
 
 #ifdef unix
+    ::pthread_exit( NULL );
     return NULL;
 #else
 

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/concurrent/MutexTest.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/concurrent/MutexTest.h?view=diff&rev=487918&r1=487917&r2=487918
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/concurrent/MutexTest.h
(original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/concurrent/MutexTest.h
Sat Dec 16 15:49:43 2006
@@ -417,15 +417,16 @@
         void test()
         {
             MyThread test;
-            test.lock();
+            
+            synchronized(&test){
 
-            test.start();
-         
-            for( int ix=0; ix<100; ix++ ){
-                test.value += 1;
+                test.start();
+             
+                for( int ix=0; ix<100; ix++ ){
+                    test.value += 1;
+                }
             }
          
-            test.unlock();
             test.join();
          
             CPPUNIT_ASSERT( test.value == 2500 );



Mime
View raw message