Author: tabish
Date: Tue May  4 20:47:55 2010
New Revision: 941035

URL: http://svn.apache.org/viewvc?rev=941035&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQCPP-277

Apply some user supplied suggestions to the Windows Thread code to try and fix 
a hang on Windows.

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=941035&r1=941034&r2=941035&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 Tue 
May  4 20:47:55 2010
@@ -117,6 +117,8 @@ namespace lang{
 
             #ifdef HAVE_PTHREAD_H
                 pthread_attr_destroy( &attributes );
+            #else
+                ::CloseHandle( handle );
             #endif
         }
 
@@ -205,17 +207,13 @@ namespace{
 
             ::TlsSetValue( currentThreadKey, NULL );
 
+            properties->state = Thread::TERMINATED;
+
             #ifndef _WIN32_WCE
                 _endthreadex( 0 );
             #else
                 ExitThread( 0 );
             #endif
-
-            ::CloseHandle( properties->handle );
-
-            properties->state = Thread::TERMINATED;
-
-            return NULL;
         }
 
     #endif
@@ -420,7 +418,7 @@ void Thread::join() throw( decaf::lang::
             void* theReturn = 0;
             pthread_join( properties->handle, &theReturn );
         #else
-            Thread::join( INFINITE, 0 );
+            ::WaitForSingleObject( properties->handle, INFINITE );
         #endif
     }
 }


Reply via email to