activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r881620 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/Thread.cpp
Date Tue, 17 Nov 2009 23:19:44 GMT
Author: tabish
Date: Tue Nov 17 23:19:44 2009
New Revision: 881620

URL: http://svn.apache.org/viewvc?rev=881620&view=rev
Log:
change code to allow for shutdown method to be called from a thread other than the one that
called init.

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=881620&r1=881619&r2=881620&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 Nov 17 23:19:44
2009
@@ -168,6 +168,8 @@
 ////////////////////////////////////////////////////////////////////////////////
 namespace{
 
+    Thread* mainThread = NULL;
+
     #ifdef HAVE_PTHREAD_H
 
         pthread_key_t currentThreadKey;
@@ -218,7 +220,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 void Thread::initThreading() {
 
-    Thread* mainThread = new Thread( "Main Thread" );
+    mainThread = new Thread( "Main Thread" );
 
     mainThread->properties->state = Thread::RUNNABLE;
     mainThread->properties->priority = Thread::NORM_PRIORITY;
@@ -248,9 +250,7 @@
 
     #ifdef HAVE_PTHREAD_H
 
-        // Get the Main Thread and Destroy it
-        Thread* mainThread = (Thread*) pthread_getspecific( currentThreadKey );
-
+        // Destroy the Main Thread instance.
         delete mainThread;
 
         // Destroy the current Thread key now, no longer needed.
@@ -258,8 +258,7 @@
 
     #else
 
-        Thread* mainThread = (Thread*) ::TlsGetValue( currentThreadKey );
-
+        // Destroy the Main Thread instance.
         delete mainThread;
 
         // Destroy our TLS resources before we shutdown.



Mime
View raw message