You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2013/01/22 15:49:20 UTC

svn commit: r1436976 - /activemq/activemq-cpp/branches/activemq-cpp-3.5.x/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.cpp

Author: tabish
Date: Tue Jan 22 14:49:20 2013
New Revision: 1436976

URL: http://svn.apache.org/viewvc?rev=1436976&view=rev
Log:
https://issues.apache.org/jira/browse/AMQCPP-449

Shutdown the Atomics last in case of no platform builtins to prevent segfault when a join on a Thread occurs in shutdown. 

Modified:
    activemq/activemq-cpp/branches/activemq-cpp-3.5.x/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.cpp

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.5.x/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.5.x/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.cpp?rev=1436976&r1=1436975&r2=1436976&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.5.x/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.cpp (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.5.x/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.cpp Tue Jan 22 14:49:20 2013
@@ -833,9 +833,8 @@ void Threading::initialize() {
 ////////////////////////////////////////////////////////////////////////////////
 void Threading::shutdown() {
 
-    // First shutdown the Executors and Atomics static data to remove dependencies on Threading.
+    // First shutdown the Executors static data to remove dependencies on Threading.
     Executors::shutdown();
-    Atomics::shutdown();
 
     // Destroy any Foreign Thread Facades that were created during runtime.
     std::vector<Thread*>::iterator iter = library->osThreads.begin();
@@ -851,8 +850,12 @@ void Threading::shutdown() {
 
     purgeMonitorsPool(library->monitors);
     delete library->monitors;
-
     delete library;
+
+    // Atomics only uses platform Thread primitives when there are no atomic
+    // builtins and Atomics are used in thread so make sure this is always last
+    // in the shutdown order.
+    Atomics::shutdown();
 }
 
 ////////////////////////////////////////////////////////////////////////////////