Author: tabish
Date: Fri Jan 18 19:24:32 2013
New Revision: 1435309
URL: http://svn.apache.org/viewvc?rev=1435309&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/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.cpp
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.cpp?rev=1435309&r1=1435308&r2=1435309&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/concurrent/Threading.cpp
Fri Jan 18 19:24:32 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();
}
////////////////////////////////////////////////////////////////////////////////
|