activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1065122 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Thread.cpp
Date Sat, 29 Jan 2011 22:04:51 GMT
Author: tabish
Date: Sat Jan 29 22:04:51 2011
New Revision: 1065122

URL: http://svn.apache.org/viewvc?rev=1065122&view=rev
Log:
Don't attempt to join is we didn't create the actual thread.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Thread.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Thread.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Thread.cpp?rev=1065122&r1=1065121&r2=1065122&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Thread.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Thread.cpp Sat Jan 29 22:04:51
2011
@@ -336,12 +336,15 @@ void Thread::initialize( Runnable* task,
 Thread::~Thread() {
     try{
 
-        #ifdef HAVE_PTHREAD_H
-            void* theReturn = 0;
-            pthread_join( properties->handle, &theReturn );
-        #else
-            ::WaitForSingleObject( properties->handle, INFINITE );
-        #endif
+        // Don't join foreign threads on destruction, we don't control them.
+        if( properties->parent != NULL ) {
+            #ifdef HAVE_PTHREAD_H
+                void* theReturn = 0;
+                pthread_join( properties->handle, &theReturn );
+            #else
+                ::WaitForSingleObject( properties->handle, INFINITE );
+            #endif
+        }
 
         delete this->properties;
     }



Mime
View raw message