activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r648777 - in /activemq/activemq-cpp/decaf/trunk/src/main/decaf/util: Collection.h Comparator.h Iterator.h Map.h Queue.h Set.h concurrent/ThreadPool.cpp
Date Wed, 16 Apr 2008 18:14:53 GMT
Author: tabish
Date: Wed Apr 16 11:14:44 2008
New Revision: 648777

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

Flushing out decaf build issues on windows.

Modified:
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Collection.h
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Comparator.h
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Iterator.h
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Map.h
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Queue.h
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Set.h
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/concurrent/ThreadPool.cpp

Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Collection.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Collection.h?rev=648777&r1=648776&r2=648777&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Collection.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Collection.h Wed Apr 16 11:14:44
2008
@@ -63,7 +63,7 @@
      * @since 1.0
      */
     template< typename T >
-    class DECAF_API Collection
+    class Collection
     {
     public:
 

Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Comparator.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Comparator.h?rev=648777&r1=648776&r2=648777&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Comparator.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Comparator.h Wed Apr 16 11:14:44
2008
@@ -35,7 +35,7 @@
      * every e1 and e2 in S.
      */
     template<typename T>
-    class DECAF_API Comparator
+    class Comparator
     {
     public:
 

Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Iterator.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Iterator.h?rev=648777&r1=648776&r2=648777&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Iterator.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Iterator.h Wed Apr 16 11:14:44 2008
@@ -31,7 +31,7 @@
      * with well defined semantics.
      */
     template< typename T>
-    class DECAF_API Iterator {
+    class Iterator {
     public:
 
         virtual ~Iterator() {}

Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Map.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Map.h?rev=648777&r1=648776&r2=648777&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Map.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Map.h Wed Apr 16 11:14:44 2008
@@ -32,7 +32,7 @@
      * a more user-friendly interface and to provide common
      * functions that do not exist in std::map.
      */
-    template <typename K, typename V> class DECAF_API Map : public concurrent::Synchronizable
+    template <typename K, typename V> class Map : public concurrent::Synchronizable
     {
     private:
 

Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Queue.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Queue.h?rev=648777&r1=648776&r2=648777&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Queue.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Queue.h Wed Apr 16 11:14:44 2008
@@ -55,7 +55,7 @@
      * polling loop to ensure that you don't get stuck there.
      */
 
-    template <typename T> class DECAF_API Queue : public concurrent::Synchronizable
{
+    template <typename T> class Queue : public concurrent::Synchronizable {
     public:
 
         Queue() {}

Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Set.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Set.h?rev=648777&r1=648776&r2=648777&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Set.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/Set.h Wed Apr 16 11:14:44 2008
@@ -33,7 +33,7 @@
      * a more user-friendly interface and to provide common
      * functions that do not exist in std::map.
      */
-    template <typename E> class DECAF_API Set : public util::concurrent::Synchronizable
+    template <typename E> class Set : public util::concurrent::Synchronizable
     {
     private:
 

Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/concurrent/ThreadPool.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/concurrent/ThreadPool.cpp?rev=648777&r1=648776&r2=648777&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/concurrent/ThreadPool.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/util/concurrent/ThreadPool.cpp Wed Apr
16 11:14:44 2008
@@ -51,15 +51,14 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-ThreadPool::~ThreadPool()
-{
-    try
-    {
+ThreadPool::~ThreadPool() {
+
+    try{
+
         std::vector<PooledThread*>::iterator itr = pool.begin();
 
         // Stop all the threads
-        for(; itr != pool.end(); ++itr)
-        {
+        for( ; itr != pool.end(); ++itr ) {
             (*itr)->stop();
         }
 
@@ -67,15 +66,13 @@
         // when we interrupt them.
         shutdown = true;
 
-        synchronized(&queue)
-        {
+        synchronized( &queue ) {
             // Signal the Queue so that all waiters are notified
             queue.notifyAll();
         }
 
         // Wait for everyone to die
-        for(itr = pool.begin(); itr != pool.end(); ++itr)
-        {
+        for( itr = pool.begin(); itr != pool.end(); ++itr ) {
             (*itr)->join();
 
             // Destroy the threads
@@ -84,32 +81,30 @@
 
         pool.clear();
     }
-    DECAF_CATCH_RETHROW( lang::Exception )
-    DECAF_CATCHALL_THROW( lang::Exception )
+    DECAF_CATCH_NOTHROW( lang::Exception )
+    DECAF_CATCHALL_NOTHROW()
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void ThreadPool::queueTask( ThreadPool::Task task )
-   throw ( lang::Exception )
-{
-    try
-    {
-        if( !task.first || !task.second )
-        {
-            throw exceptions::IllegalArgumentException( __FILE__, __LINE__,
+   throw ( lang::Exception ) {
+
+    try{
+        
+        if( !task.first || !task.second ) {
+            throw exceptions::IllegalArgumentException( 
+                __FILE__, __LINE__,
                 "ThreadPool::QueueTask - Invalid args for Task");
         }
 
         //LOGCMS_DEBUG(logger, "ThreadPool::QueueTask - syncing on queue");
 
-        synchronized(&queue)
-        {
+        synchronized( &queue ) {
             //LOGCMS_DEBUG(logger, "ThreadPool::QueueTask - sync'd, synching pool");
 
             // If there's nobody open to do work, then create some more
             // threads to handle the work.
-            if(freeThreads == 0)
-            {
+            if( freeThreads == 0 ) {
                 AllocateThreads(blockSize);
             }
 
@@ -130,46 +125,43 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 ThreadPool::Task ThreadPool::deQueueTask()
-   throw ( lang::Exception )
-{
-    try
-    {
+    throw ( lang::Exception ) {
+    
+    try{
         //LOGCMS_DEBUG(logger, "ThreadPool::DeQueueTask - syncing on queue");
 
-        synchronized(&queue)
-        {
-            /*LOGCMS_DEBUG(logger,
-                "ThreadPool::DeQueueTask - sync'd checking queue empty");*/
-
-           // Wait for work, wait in a while loop since another thread could
-           // be waiting for a lock and get the work before we get woken up
-           // from our wait.
-           while(queue.empty() && !shutdown)
-           {
+        synchronized( &queue ) {
+
+           /*LOGCMS_DEBUG(logger,
+               "ThreadPool::DeQueueTask - sync'd checking queue empty");*/
+
+            // Wait for work, wait in a while loop since another thread could
+            // be waiting for a lock and get the work before we get woken up
+            // from our wait.
+            while( queue.empty() && !shutdown ) {
                //LOGCMS_DEBUG(logger, "ThreadPool::DeQueueTask - Q empty, waiting");
 
                queue.wait();
 
                //LOGCMS_DEBUG(logger, "ThreadPool::DeQueueTask - done waiting");
-           }
+            }
 
-           // Don't give more work if we are closing down
-           if(shutdown)
-           {
+            // Don't give more work if we are closing down
+            if( shutdown ) {
                return Task();
-           }
+            }
 
-           // check size again.
-           if(queue.empty())
-           {
-               throw lang::Exception( __FILE__, __LINE__,
+            // check size again.
+            if( queue.empty() ) {
+               throw lang::Exception( 
+                   __FILE__, __LINE__,
                    "ThreadPool::DeQueueUserWorkItem - Empty Taskn, not in shutdown.");
-           }
+            }
 
-           //LOGCMS_DEBUG(logger, "ThreadPool::DeQueueTask - popping task");
+            //LOGCMS_DEBUG(logger, "ThreadPool::DeQueueTask - popping task");
 
-           // not empty so get the new work to do
-           return queue.pop();
+            // not empty so get the new work to do
+            return queue.pop();
         }
 
         return Task();
@@ -179,14 +171,13 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ThreadPool::reserve( std::size_t size )
-{
-    try
-    {
-        synchronized(&poolLock)
-        {
-            if(size < pool.size() || pool.size() == maxThreads)
-            {
+void ThreadPool::reserve( std::size_t size ) {
+    
+    try {
+        
+        synchronized( &poolLock ) {
+            
+            if( size < pool.size() || pool.size() == maxThreads ) {
                 return;
             }
 
@@ -202,14 +193,13 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ThreadPool::setMaxThreads( std::size_t maxThreads )
-{
-    try
-    {
-        synchronized(&poolLock)
-        {
-            if(maxThreads == 0)
-            {
+void ThreadPool::setMaxThreads( std::size_t maxThreads ) {
+
+    try{
+        
+        synchronized( &poolLock ) {
+            
+            if( maxThreads == 0 ) {
                 // Caller tried to do something stupid, ignore them.
                 return;
             }
@@ -222,18 +212,15 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ThreadPool::setBlockSize( std::size_t blockSize )
-{
-    try
-    {
-        if(blockSize <= 0)
-        {
+void ThreadPool::setBlockSize( std::size_t blockSize ) {
+    
+    try{
+        if( blockSize <= 0 ) {
             // User tried something dumb, protect them from themselves
             return;
         }
 
-        synchronized(&poolLock)
-        {
+        synchronized( &poolLock ) {
             this->blockSize = blockSize;
         }
     }
@@ -242,17 +229,15 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ThreadPool::AllocateThreads( std::size_t count )
-{
-    try
-    {
-        if(pool.size() >= maxThreads)
-        {
+void ThreadPool::AllocateThreads( std::size_t count ) {
+
+    try{
+
+        if( pool.size() >= maxThreads ) {
             return;
         }
 
-        synchronized(&poolLock)
-        {
+        synchronized( &poolLock ) {
             // Take the min of alloc size of maxThreads since we don't
             // want anybody sneaking eaxtra threads in, greedy bastards.
             count = std::min(count, maxThreads - pool.size());
@@ -260,8 +245,7 @@
             // Each time we create a thread we increment the free Threads
             // counter, but before we call start so that the Thread doesn't
             // get ahead of us.
-            for(std::size_t i = 0; i < count; ++i)
-            {
+            for( std::size_t i = 0; i < count; ++i ) {
                 pool.push_back(new PooledThread(this));
                 pool.back()->setPooledThreadListener(this);
                 freeThreads++;
@@ -274,12 +258,12 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ThreadPool::onTaskStarted( PooledThread* thread DECAF_UNUSED )
-{
-    try
-    {
-        synchronized(&poolLock)
-        {
+void ThreadPool::onTaskStarted( PooledThread* thread DECAF_UNUSED ) {
+    
+    try{
+        
+        synchronized( &poolLock ) {
+
             freeThreads--;
 
             // Now that this callback has decremented the free threads coutner
@@ -289,8 +273,7 @@
             // having a chance to wake up and service the queue.  This would
             // cause the number of Task to exceed the number of free threads
             // once the Threads got a chance to wake up and service the queue
-            if( freeThreads == 0 && !queue.empty() )
-            {
+            if( freeThreads == 0 && !queue.empty() ) {
                 // Allocate a new block of threads
                 AllocateThreads( blockSize );
             }
@@ -303,12 +286,10 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void ThreadPool::onTaskCompleted( PooledThread* thread DECAF_UNUSED)
-{
-    try
-    {
-        synchronized(&poolLock)
-        {
+void ThreadPool::onTaskCompleted( PooledThread* thread DECAF_UNUSED) {
+
+    try {
+        synchronized( &poolLock ) {
             freeThreads++;
         }
 
@@ -321,14 +302,14 @@
 ////////////////////////////////////////////////////////////////////////////////
 void ThreadPool::onTaskException(
    PooledThread* thread,
-   lang::Exception& ex DECAF_UNUSED )
-{
+   lang::Exception& ex DECAF_UNUSED ) {
+    
     //LOGCMS_DEBUG(logger, "ThreadPool::onTaskException: ");
 
-    try
-    {
-        synchronized(&poolLock)
-        {
+    try{
+        
+        synchronized( &poolLock ) {
+            
             // Delete the thread that had the exception and start a new
             // one to take its place.
             freeThreads--;
@@ -336,8 +317,7 @@
             std::vector<PooledThread*>::iterator itr =
                 std::find(pool.begin(), pool.end(), thread);
 
-            if(itr != pool.end())
-            {
+            if( itr != pool.end() ) {
                 pool.erase(itr);
             }
 
@@ -351,4 +331,3 @@
     DECAF_CATCH_RETHROW( lang::Exception )
     DECAF_CATCHALL_THROW( lang::Exception )
 }
-



Mime
View raw message