activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1447893 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ThreadPoolExecutor.cpp
Date Tue, 19 Feb 2013 20:10:52 GMT
Author: tabish
Date: Tue Feb 19 20:10:52 2013
New Revision: 1447893

URL: http://svn.apache.org/r1447893
Log:
fix for: https://issues.apache.org/jira/browse/AMQCPP-464

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ThreadPoolExecutor.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ThreadPoolExecutor.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ThreadPoolExecutor.cpp?rev=1447893&r1=1447892&r2=1447893&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ThreadPoolExecutor.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ThreadPoolExecutor.cpp
Tue Feb 19 20:10:52 2013
@@ -245,17 +245,25 @@ namespace concurrent{
             virtual void run() {
                 kernel->mainLock.lock();
 
-                if (!kernel->isTerminated()) {
-                    try {
-                        Pointer< Iterator<Worker*> > iter( kernel->deadWorkers.iterator()
);
-                        while(iter->hasNext()) {
-                            delete iter->next();
-                            iter->remove();
-                        }
-                    } catch(...) {}
+                LinkedList<Worker*> toDeleteList;
+
+                try {
+                    if (!kernel->isTerminated()) {
+                        toDeleteList.copy(kernel->deadWorkers);
+                        kernel->deadWorkers.clear();
+                    }
+                } catch(...) {
                 }
 
                 kernel->mainLock.unlock();
+
+                try {
+                    Pointer< Iterator<Worker*> > iter(toDeleteList.iterator());
+                    while(iter->hasNext()) {
+                        delete iter->next();
+                        iter->remove();
+                    }
+                } catch(...) {}
             }
         };
 



Mime
View raw message