[asterisk-scf-commits] asterisk-scf/integration/ice-util-cpp.git branch "queue-shutdown" created.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Jun 6 16:06:59 CDT 2011


branch "queue-shutdown" has been created
        at  d813bbcb95b2151ea23404268e18d2fcb891fd20 (commit)

- Log -----------------------------------------------------------------
commit d813bbcb95b2151ea23404268e18d2fcb891fd20
Author: Mark Michelson <mmichelson at digium.com>
Date:   Mon Jun 6 16:05:40 2011 -0500

    Changes based on slice changes to create a QueueBase interface.

diff --git a/include/AsteriskSCF/WorkQueue/DefaultQueueListener.h b/include/AsteriskSCF/WorkQueue/DefaultQueueListener.h
index 8190810..6169552 100644
--- a/include/AsteriskSCF/WorkQueue/DefaultQueueListener.h
+++ b/include/AsteriskSCF/WorkQueue/DefaultQueueListener.h
@@ -43,12 +43,14 @@ class DefaultQueueListenerPriv;
 class ASTERISK_SCF_ICEBOX_EXPORT DefaultQueueListener : public AsteriskSCF::System::WorkQueue::V1::QueueListener
 {
 public:
-    DefaultQueueListener(const AsteriskSCF::System::WorkQueue::V1::QueuePtr& queue);
+    DefaultQueueListener(const AsteriskSCF::System::WorkQueue::V1::QueueBasePtr& queue);
     ~DefaultQueueListener();
-    void workAdded(Ice::Long numNewWork, bool wasEmpty);
-    void workResumable();
-    void emptied();
-    void shuttingDown();
+    
+    void workAdded(const AsteriskSCF::System::WorkQueue::V1::QueueBasePtr&, Ice::Long numNewWork, bool wasEmpty);
+    void workResumable(const AsteriskSCF::System::WorkQueue::V1::QueueBasePtr&);
+    void emptied(const AsteriskSCF::System::WorkQueue::V1::QueueBasePtr&);
+    void shuttingDown(const AsteriskSCF::System::WorkQueue::V1::QueueBasePtr&);
+
 private:
     boost::shared_ptr<DefaultQueueListenerPriv> mPriv;
 };
diff --git a/src/ThreadPool/ThreadPool.cpp b/src/ThreadPool/ThreadPool.cpp
index ab7bda7..219335c 100644
--- a/src/ThreadPool/ThreadPool.cpp
+++ b/src/ThreadPool/ThreadPool.cpp
@@ -425,7 +425,7 @@ public:
     /**
      * Results in PoolListener::queueWorkAdded being called
      */
-    void workAdded(Ice::Long numNewWork, bool wasEmpty)
+    void workAdded(const QueueBasePtr&, Ice::Long numNewWork, bool wasEmpty)
     {
         mThreadPool->handleWorkAdded(numNewWork, wasEmpty);
     }
@@ -434,7 +434,7 @@ public:
      * Should never be called since a ThreadPool does not
      * use a SuspendableQueue
      */
-    void workResumable()
+    void workResumable(const QueueBasePtr&)
     {
         assert(false);
     }
@@ -442,12 +442,12 @@ public:
     /**
      * Results in PoolListener::queueEmptied being called
      */
-    void emptied()
+    void emptied(const QueueBasePtr&)
     {
         mThreadPool->handleEmptied();
     }
 
-    void shuttingDown()
+    void shuttingDown(const QueueBasePtr&)
     {
     }
 
diff --git a/src/WorkQueue/DefaultQueueListener.cpp b/src/WorkQueue/DefaultQueueListener.cpp
index c450339..82490b3 100644
--- a/src/WorkQueue/DefaultQueueListener.cpp
+++ b/src/WorkQueue/DefaultQueueListener.cpp
@@ -27,8 +27,8 @@ using namespace AsteriskSCF::System::WorkQueue::V1;
 class DefaultQueueListenerPriv
 {
 public:
-    DefaultQueueListenerPriv(const QueuePtr& queue)
-        : mWakeUp(false), mDead(false), mQueue(queue.get()),
+    DefaultQueueListenerPriv(const QueueBasePtr& queue)
+        : mWakeUp(false), mDead(false), mQueue(queue),
         mIsShutdown(false),
         mThread(boost::bind(&DefaultQueueListenerPriv::run, this)) { }
 
@@ -80,26 +80,17 @@ public:
 
     bool mWakeUp;
     bool mDead;
-    QueuePtr mQueue;
+    QueueBasePtr mQueue;
     boost::mutex mLock;
     boost::condition_variable mCond;
     bool mIsShutdown;
     boost::thread mThread;
 };
 
-DefaultQueueListener::DefaultQueueListener(const QueuePtr& queue)
+DefaultQueueListener::DefaultQueueListener(const QueueBasePtr& queue)
     : mPriv(new DefaultQueueListenerPriv(queue)) { }
 
-DefaultQueueListener::~DefaultQueueListener()
-{
-    if (!mPriv->mIsShutdown)
-    {
-        mPriv->setDead(true);
-        mPriv->mThread.join();
-    }
-}
-
-void DefaultQueueListener::workAdded(Ice::Long, bool wasEmpty)
+void DefaultQueueListener::workAdded(const QueueBasePtr&, Ice::Long, bool wasEmpty)
 {
     if (wasEmpty)
     {
@@ -107,16 +98,16 @@ void DefaultQueueListener::workAdded(Ice::Long, bool wasEmpty)
     }
 }
 
-void DefaultQueueListener::workResumable()
+void DefaultQueueListener::workResumable(const QueueBasePtr&)
 {
     mPriv->setDead(false);
 }
 
-void DefaultQueueListener::emptied()
+void DefaultQueueListener::emptied(const QueueBasePtr&)
 {
 }
 
-void DefaultQueueListener::shuttingDown()
+void DefaultQueueListener::shuttingDown(const QueueBasePtr&)
 {
     mPriv->mIsShutdown = true;
     mPriv->setDead(true);
diff --git a/src/WorkQueue/SuspendableWorkQueue.cpp b/src/WorkQueue/SuspendableWorkQueue.cpp
index e1a5c2a..b5346d2 100644
--- a/src/WorkQueue/SuspendableWorkQueue.cpp
+++ b/src/WorkQueue/SuspendableWorkQueue.cpp
@@ -204,8 +204,8 @@ public:
 class WorkListener : public SuspendableWorkListener
 {
 public:
-    WorkListener(boost::shared_ptr<SuspendableWorkQueuePriv> impl)
-        : mPriv(impl) { }
+    WorkListener(const QueueBasePtr& q, boost::shared_ptr<SuspendableWorkQueuePriv> impl)
+        : mPriv(impl), mQueue(q) { }
     void workResumable()
     {
         SuspendableWorkQueuePriv::WorkState previousState;
@@ -227,11 +227,12 @@ public:
         // suspended state.
         if (previousState == SuspendableWorkQueuePriv::Suspended)
         {
-            mPriv->mListener->workResumable();
+            mPriv->mListener->workResumable(mQueue);
         }
     }
 
     boost::shared_ptr<SuspendableWorkQueuePriv> mPriv;
+    QueueBasePtr mQueue;
 };
 
 SuspendableWorkQueue::SuspendableWorkQueue()
@@ -255,7 +256,7 @@ void SuspendableWorkQueue::enqueueWork(const SuspendableWorkPtr& work)
 
     if (listenerRef != 0)
     {
-        listenerRef->workAdded(1, wasEmpty);
+        listenerRef->workAdded(this, 1, wasEmpty);
     }
 }
 
@@ -274,7 +275,7 @@ void SuspendableWorkQueue::enqueueWorkSeq(const SuspendableWorkSeq& works)
 
     if (listenerRef != 0)
     {
-        listenerRef->workAdded(works.size(), wasEmpty);
+        listenerRef->workAdded(this, works.size(), wasEmpty);
     }
 }
 
@@ -305,7 +306,7 @@ void SuspendableWorkQueue::cancelWork(const SuspendableWorkPtr& work)
 
     if (isEmpty && listenerRef != 0)
     {
-        listenerRef->emptied();
+        listenerRef->emptied(this);
     }
 }
 
@@ -319,7 +320,7 @@ bool SuspendableWorkQueue::executeWork()
         return false;
     }
     
-    SuspendableWorkListenerPtr workListener(new WorkListener(mPriv));
+    SuspendableWorkListenerPtr workListener(new WorkListener(this, mPriv));
     SuspendableWorkResult result = work->execute(workListener);
 
     bool isEmpty;
@@ -362,7 +363,7 @@ bool SuspendableWorkQueue::executeWork()
     {
         if (listenerRef != 0)
         {
-            mPriv->mListener->emptied();
+            mPriv->mListener->emptied(this);
         }
         return false;
     }
@@ -388,7 +389,7 @@ void SuspendableWorkQueue::shutDown()
     boost::unique_lock<boost::shared_mutex> lock(mPriv->mLock);
     mPriv->checkForShuttingDown();
     mPriv->mShuttingDown = true;
-    mPriv->mListener->shuttingDown();
+    mPriv->mListener->shuttingDown(this);
 }
 
 }; //end namespace WorkQueue
diff --git a/src/WorkQueue/WorkQueue.cpp b/src/WorkQueue/WorkQueue.cpp
index 8119e18..fa50b5c 100644
--- a/src/WorkQueue/WorkQueue.cpp
+++ b/src/WorkQueue/WorkQueue.cpp
@@ -95,7 +95,7 @@ void WorkQueue::enqueueWork(const WorkPtr& work)
 
     if (listenerRef != 0)
     {
-        listenerRef->workAdded(1, wasEmpty);
+        listenerRef->workAdded(this, 1, wasEmpty);
     }
 }
 
@@ -113,7 +113,7 @@ void WorkQueue::enqueueWorkSeq(const WorkSeq& works)
 
     if (listenerRef != 0)
     {
-        listenerRef->workAdded(static_cast<long>(works.size()), wasEmpty);
+        listenerRef->workAdded(this, static_cast<long>(works.size()), wasEmpty);
     }
 }
 
@@ -139,7 +139,7 @@ void WorkQueue::cancelWork(const WorkPtr& work)
 
     if (isEmpty && listenerRef != 0)
     {
-        listenerRef->emptied();
+        listenerRef->emptied(this);
     }
 }
 
@@ -164,7 +164,7 @@ bool WorkQueue::executeWork()
     {
         if (listenerRef != 0)
         {
-            listenerRef->emptied();
+            listenerRef->emptied(this);
         }
         return false;
     }
@@ -190,7 +190,7 @@ void WorkQueue::shutDown()
     boost::unique_lock<boost::shared_mutex> lock(mPriv->mLock);
     mPriv->checkForShuttingDown();
     mPriv->mShuttingDown = true;
-    mPriv->mListener->shuttingDown();
+    mPriv->mListener->shuttingDown(this);
 }
 
 }; // end namespace WorkQueue

commit eb3e3d33fd4fbdb5e734bdac29572f9e2aab8c17
Author: Mark Michelson <mmichelson at digium.com>
Date:   Mon Jun 6 14:58:18 2011 -0500

    Make adjustments based on Kevin's feedback.
    
    * Add shutDown method for Queue and SuspendableQueue
    * Add shuttingDown method for QueueListener

diff --git a/include/AsteriskSCF/WorkQueue/DefaultQueueListener.h b/include/AsteriskSCF/WorkQueue/DefaultQueueListener.h
index 01b4090..8190810 100644
--- a/include/AsteriskSCF/WorkQueue/DefaultQueueListener.h
+++ b/include/AsteriskSCF/WorkQueue/DefaultQueueListener.h
@@ -48,6 +48,7 @@ public:
     void workAdded(Ice::Long numNewWork, bool wasEmpty);
     void workResumable();
     void emptied();
+    void shuttingDown();
 private:
     boost::shared_ptr<DefaultQueueListenerPriv> mPriv;
 };
diff --git a/include/AsteriskSCF/WorkQueue/SuspendableWorkQueue.h b/include/AsteriskSCF/WorkQueue/SuspendableWorkQueue.h
index d2b79be..8c3ba09 100644
--- a/include/AsteriskSCF/WorkQueue/SuspendableWorkQueue.h
+++ b/include/AsteriskSCF/WorkQueue/SuspendableWorkQueue.h
@@ -41,6 +41,7 @@ public:
     bool executeWork();
     Ice::Long getSize();
     void setListener(const AsteriskSCF::System::WorkQueue::V1::QueueListenerPtr& listener);
+    void shutDown();
 private:
     boost::shared_ptr<SuspendableWorkQueuePriv> mPriv;
 };
diff --git a/include/AsteriskSCF/WorkQueue/WorkQueue.h b/include/AsteriskSCF/WorkQueue/WorkQueue.h
index 0365537..f7aee13 100644
--- a/include/AsteriskSCF/WorkQueue/WorkQueue.h
+++ b/include/AsteriskSCF/WorkQueue/WorkQueue.h
@@ -40,6 +40,7 @@ public:
     bool executeWork();
     Ice::Long getSize();
     void setListener(const AsteriskSCF::System::WorkQueue::V1::QueueListenerPtr& listener);
+    void shutDown();
 private:
     boost::shared_ptr<WorkQueuePriv> mPriv;
 };
diff --git a/src/ThreadPool/ThreadPool.cpp b/src/ThreadPool/ThreadPool.cpp
index ac9aff3..ab7bda7 100644
--- a/src/ThreadPool/ThreadPool.cpp
+++ b/src/ThreadPool/ThreadPool.cpp
@@ -60,6 +60,7 @@ public:
         {
             boost::lock_guard<boost::mutex> lock(mQueueLock);
             mShuttingDown = true;
+            mControlQueue->shutDown();
             mControlQueue = 0;
         }
 
@@ -445,6 +446,11 @@ public:
     {
         mThreadPool->handleEmptied();
     }
+
+    void shuttingDown()
+    {
+    }
+
 private:
     ThreadPool *mThreadPool;
 };
diff --git a/src/WorkQueue/DefaultQueueListener.cpp b/src/WorkQueue/DefaultQueueListener.cpp
index cccf50b..c450339 100644
--- a/src/WorkQueue/DefaultQueueListener.cpp
+++ b/src/WorkQueue/DefaultQueueListener.cpp
@@ -29,6 +29,7 @@ class DefaultQueueListenerPriv
 public:
     DefaultQueueListenerPriv(const QueuePtr& queue)
         : mWakeUp(false), mDead(false), mQueue(queue.get()),
+        mIsShutdown(false),
         mThread(boost::bind(&DefaultQueueListenerPriv::run, this)) { }
 
     bool idle()
@@ -54,14 +55,22 @@ public:
         bool localDead = false;
         while (!localDead)
         {
-            if (!mQueue->executeWork())
+            try
             {
+                if (!mQueue->executeWork())
+                {
+                    localDead = idle();
+                }
+            }
+            catch (ShuttingDown)
+            {
+                //Just go idle if the queue has shut down.
                 localDead = idle();
             }
         }
     }
 
-    void setState(bool dead)
+    void setDead(bool dead)
     {
         boost::unique_lock<boost::mutex> lock(mLock);
         mWakeUp = true;
@@ -71,9 +80,10 @@ public:
 
     bool mWakeUp;
     bool mDead;
-    Queue *mQueue;
+    QueuePtr mQueue;
     boost::mutex mLock;
     boost::condition_variable mCond;
+    bool mIsShutdown;
     boost::thread mThread;
 };
 
@@ -82,26 +92,37 @@ DefaultQueueListener::DefaultQueueListener(const QueuePtr& queue)
 
 DefaultQueueListener::~DefaultQueueListener()
 {
-    mPriv->setState(true);
-    mPriv->mThread.join();
+    if (!mPriv->mIsShutdown)
+    {
+        mPriv->setDead(true);
+        mPriv->mThread.join();
+    }
 }
 
 void DefaultQueueListener::workAdded(Ice::Long, bool wasEmpty)
 {
     if (wasEmpty)
     {
-        mPriv->setState(false);
+        mPriv->setDead(false);
     }
 }
 
 void DefaultQueueListener::workResumable()
 {
-    mPriv->setState(false);
+    mPriv->setDead(false);
 }
 
 void DefaultQueueListener::emptied()
 {
 }
 
+void DefaultQueueListener::shuttingDown()
+{
+    mPriv->mIsShutdown = true;
+    mPriv->setDead(true);
+    mPriv->mThread.join();
+    mPriv->mQueue = 0;
+}
+
 }; //end namespace WorkQueue
 }; //end namespace AsteriskSCF
diff --git a/src/WorkQueue/SuspendableWorkQueue.cpp b/src/WorkQueue/SuspendableWorkQueue.cpp
index 771adc0..e1a5c2a 100644
--- a/src/WorkQueue/SuspendableWorkQueue.cpp
+++ b/src/WorkQueue/SuspendableWorkQueue.cpp
@@ -31,9 +31,9 @@ class SuspendableWorkQueuePriv
 {
 public:
     SuspendableWorkQueuePriv()
-        : mListener(0), state(Ready), currentWork(0) { }
+        : mListener(0), state(Ready), currentWork(0), mShuttingDown(false) { }
     SuspendableWorkQueuePriv(const QueueListenerPtr& listener)
-        : mListener(listener), state(Ready), currentWork(0) { }
+        : mListener(listener), state(Ready), currentWork(0), mShuttingDown(false) { }
 
     ~SuspendableWorkQueuePriv()
     {
@@ -55,6 +55,7 @@ public:
     {
         boost::unique_lock<boost::shared_mutex> lock(mLock);
 
+        checkForShuttingDown();
         SuspendableWorkPtr work;
         switch (state)
         {
@@ -82,6 +83,14 @@ public:
         return work;
     }
 
+    void checkForShuttingDown()
+    {
+        if (mShuttingDown)
+        {
+            throw ShuttingDown(__FILE__, __LINE__);
+        }
+    }
+
     QueueListenerPtr mListener;
     boost::shared_mutex mLock;
     std::deque<SuspendableWorkPtr> mQueue;
@@ -188,6 +197,8 @@ public:
      * when asked.
      */
     SuspendableWorkPtr currentWork;
+
+    bool mShuttingDown;
 };
 
 class WorkListener : public SuspendableWorkListener
@@ -235,6 +246,7 @@ void SuspendableWorkQueue::enqueueWork(const SuspendableWorkPtr& work)
     QueueListenerPtr listenerRef;
     {
         boost::unique_lock<boost::shared_mutex> lock(mPriv->mLock);
+        mPriv->checkForShuttingDown();
         //Call private version so we don't double grab the lock
         wasEmpty = mPriv->getSize() == 0; 
         mPriv->mQueue.push_back(work);
@@ -253,6 +265,7 @@ void SuspendableWorkQueue::enqueueWorkSeq(const SuspendableWorkSeq& works)
     QueueListenerPtr listenerRef;
     {
         boost::unique_lock<boost::shared_mutex> lock(mPriv->mLock);
+        mPriv->checkForShuttingDown();
         //Call private version so we don't double grab the lock
         wasEmpty = mPriv->getSize() == 0;
         mPriv->mQueue.insert(mPriv->mQueue.end(), works.begin(), works.end());
@@ -272,6 +285,8 @@ void SuspendableWorkQueue::cancelWork(const SuspendableWorkPtr& work)
     {
         boost::unique_lock<boost::shared_mutex> lock(mPriv->mLock);
 
+        mPriv->checkForShuttingDown();
+
         if (work == mPriv->currentWork)
         {
             throw WorkInProgress(__FILE__, __LINE__);
@@ -357,14 +372,24 @@ bool SuspendableWorkQueue::executeWork()
 Ice::Long SuspendableWorkQueue::getSize()
 {
     boost::shared_lock<boost::shared_mutex> lock(mPriv->mLock);
+    mPriv->checkForShuttingDown();
     return mPriv->getSize();
 }
 
 void SuspendableWorkQueue::setListener(const QueueListenerPtr& listener)
 {
     boost::unique_lock<boost::shared_mutex> lock(mPriv->mLock);
+    mPriv->checkForShuttingDown();
     mPriv->mListener = listener;
 }
 
+void SuspendableWorkQueue::shutDown()
+{
+    boost::unique_lock<boost::shared_mutex> lock(mPriv->mLock);
+    mPriv->checkForShuttingDown();
+    mPriv->mShuttingDown = true;
+    mPriv->mListener->shuttingDown();
+}
+
 }; //end namespace WorkQueue
 }; //end namespace AsteriskSCF
diff --git a/src/WorkQueue/WorkQueue.cpp b/src/WorkQueue/WorkQueue.cpp
index d31cf25..8119e18 100644
--- a/src/WorkQueue/WorkQueue.cpp
+++ b/src/WorkQueue/WorkQueue.cpp
@@ -31,9 +31,9 @@ class WorkQueuePriv
 {
 public:
     WorkQueuePriv()
-        : mListener(0) { }
+        : mListener(0), mShuttingDown(false) { }
     WorkQueuePriv(const QueueListenerPtr& listener)
-        : mListener(listener) { }
+        : mListener(listener), mShuttingDown(false) { }
 
     ~WorkQueuePriv()
     {
@@ -46,6 +46,7 @@ public:
     WorkPtr getNextTask()
     {
         boost::unique_lock<boost::shared_mutex> lock(mLock);
+        checkForShuttingDown();
         if (mQueue.empty())
         {
             return 0;
@@ -56,9 +57,22 @@ public:
         return work;
     }
 
+    /**
+     * Throw an exception if the queue is shutting down.
+     * This should be called with mLock locked.
+     */
+    void checkForShuttingDown()
+    {
+        if (mShuttingDown)
+        {
+            throw ShuttingDown(__FILE__, __LINE__);
+        }
+    }
+
     QueueListenerPtr mListener;
     boost::shared_mutex mLock;
     std::deque<WorkPtr> mQueue;
+    bool mShuttingDown;
 };
 
 WorkQueue::WorkQueue()
@@ -73,6 +87,7 @@ void WorkQueue::enqueueWork(const WorkPtr& work)
     QueueListenerPtr listenerRef;
     {
         boost::unique_lock<boost::shared_mutex> lock(mPriv->mLock);
+        mPriv->checkForShuttingDown();
         wasEmpty = mPriv->mQueue.empty();
         listenerRef = mPriv->mListener;
         mPriv->mQueue.push_back(work);
@@ -90,6 +105,7 @@ void WorkQueue::enqueueWorkSeq(const WorkSeq& works)
     QueueListenerPtr listenerRef;
     {
         boost::unique_lock<boost::shared_mutex> lock(mPriv->mLock);
+        mPriv->checkForShuttingDown();
         wasEmpty = mPriv->mQueue.empty();
         listenerRef = mPriv->mListener;
         mPriv->mQueue.insert(mPriv->mQueue.end(), works.begin(), works.end());
@@ -108,6 +124,8 @@ void WorkQueue::cancelWork(const WorkPtr& work)
     {
         boost::unique_lock<boost::shared_mutex> lock(mPriv->mLock);
 
+        mPriv->checkForShuttingDown();
+
         std::deque<WorkPtr>::iterator i = std::find(mPriv->mQueue.begin(), mPriv->mQueue.end(), work);
         if (i == mPriv->mQueue.end())
         {
@@ -156,14 +174,24 @@ bool WorkQueue::executeWork()
 Ice::Long WorkQueue::getSize()
 {
     boost::shared_lock<boost::shared_mutex> lock(mPriv->mLock);
+    mPriv->checkForShuttingDown();
     return static_cast<long>(mPriv->mQueue.size());
 }
 
 void WorkQueue::setListener(const QueueListenerPtr& listener)
 {
     boost::unique_lock<boost::shared_mutex> lock(mPriv->mLock);
+    mPriv->checkForShuttingDown();
     mPriv->mListener = listener;
 }
 
+void WorkQueue::shutDown()
+{
+    boost::unique_lock<boost::shared_mutex> lock(mPriv->mLock);
+    mPriv->checkForShuttingDown();
+    mPriv->mShuttingDown = true;
+    mPriv->mListener->shuttingDown();
+}
+
 }; // end namespace WorkQueue
 }; // end namespace AsteriskSCF
diff --git a/test/ThreadPool/TestThreadPool.cpp b/test/ThreadPool/TestThreadPool.cpp
index 05b032f..081cfaa 100644
--- a/test/ThreadPool/TestThreadPool.cpp
+++ b/test/ThreadPool/TestThreadPool.cpp
@@ -193,6 +193,8 @@ BOOST_AUTO_TEST_CASE(addWork)
     BOOST_CHECK(listener->mActive == 0);
     BOOST_CHECK(listener->mIdle == 0);
     BOOST_CHECK(listener->mZombie == 0);
+
+    queue->shutDown();
 }
 
 BOOST_AUTO_TEST_CASE(threadCreation)
@@ -214,6 +216,7 @@ BOOST_AUTO_TEST_CASE(threadCreation)
     BOOST_CHECK(listener->mIdle == 1);
     BOOST_CHECK(listener->mActive == 0);
     BOOST_CHECK(listener->mZombie == 0);
+    queue->shutDown();
 }
 
 BOOST_AUTO_TEST_CASE(threadDestruction)
@@ -240,6 +243,7 @@ BOOST_AUTO_TEST_CASE(threadDestruction)
     BOOST_CHECK(listener->mIdle == 2);
     BOOST_CHECK(listener->mActive == 0);
     BOOST_CHECK(listener->mZombie == 0);
+    queue->shutDown();
 }
 
 BOOST_AUTO_TEST_CASE(oneTaskOneThread)
@@ -271,6 +275,7 @@ BOOST_AUTO_TEST_CASE(oneTaskOneThread)
     BOOST_CHECK(listener->mIdle == 1);
     BOOST_CHECK(listener->mActive == 0);
     BOOST_CHECK(listener->mZombie == 0);
+    queue->shutDown();
 }
 
 BOOST_AUTO_TEST_CASE(oneThreadOneTask)
@@ -304,6 +309,7 @@ BOOST_AUTO_TEST_CASE(oneThreadOneTask)
     BOOST_CHECK(listener->mIdle == 1);
     BOOST_CHECK(listener->mActive == 0);
     BOOST_CHECK(listener->mZombie == 0);
+    queue->shutDown();
 }
 
 BOOST_AUTO_TEST_CASE(oneThreadMultipleTasks)
@@ -342,6 +348,7 @@ BOOST_AUTO_TEST_CASE(oneThreadMultipleTasks)
     BOOST_CHECK(listener->mIdle == 1);
     BOOST_CHECK(listener->mActive == 0);
     BOOST_CHECK(listener->mZombie == 0);
+    queue->shutDown();
 }
 
 BOOST_AUTO_TEST_CASE(reactivation)
@@ -384,6 +391,8 @@ BOOST_AUTO_TEST_CASE(reactivation)
     BOOST_CHECK(listener->mIdle == 1);
     BOOST_CHECK(listener->mActive == 0);
     BOOST_CHECK(listener->mZombie == 0);
+
+    queue->shutDown();
 }
 
 BOOST_AUTO_TEST_CASE(taskDistribution)
@@ -435,6 +444,7 @@ BOOST_AUTO_TEST_CASE(taskDistribution)
     BOOST_CHECK(listener->mIdle == 2);
     BOOST_CHECK(listener->mActive == 0);
     BOOST_CHECK(listener->mZombie == 0);
+    queue->shutDown();
 }
 
 BOOST_AUTO_TEST_CASE(zombies)
@@ -548,5 +558,4 @@ BOOST_AUTO_TEST_CASE(moreThreadDestruction)
     BOOST_CHECK(listener->mIdle == 1);
     BOOST_CHECK(listener->mZombie == 0);
 }
-
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/test/WorkQueue/TestSuspendableWorkQueue.cpp b/test/WorkQueue/TestSuspendableWorkQueue.cpp
index 78276ee..176b48f 100644
--- a/test/WorkQueue/TestSuspendableWorkQueue.cpp
+++ b/test/WorkQueue/TestSuspendableWorkQueue.cpp
@@ -29,7 +29,8 @@ public:
         : addedNotice(false),
         addedEmptyNotice(false),
         emptyNotice(false),
-        resumableNotice(false) { }
+        resumableNotice(false),
+        shutdownNotice(false) { }
 
     void workAdded(Ice::Long, bool wasEmpty)
     {
@@ -49,10 +50,16 @@ public:
         mCond.notify_one();
     }
 
+    void shuttingDown()
+    {
+        shutdownNotice = true;
+    }
+
     bool addedNotice;
     bool addedEmptyNotice;
     bool emptyNotice;
     bool resumableNotice;
+    bool shutdownNotice;
     boost::mutex mLock;
     boost::condition_variable mCond;
 };
@@ -183,6 +190,10 @@ BOOST_AUTO_TEST_CASE(addWork)
     BOOST_CHECK(listener->addedNotice == true);
     BOOST_CHECK(listener->addedEmptyNotice == true);
     BOOST_CHECK(queue->getSize() == 1);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
 }
 
 BOOST_AUTO_TEST_CASE(addWorkSeq)
@@ -201,6 +212,86 @@ BOOST_AUTO_TEST_CASE(addWorkSeq)
     BOOST_CHECK(listener->addedEmptyNotice == true);
     BOOST_CHECK(listener->emptyNotice == false);
     BOOST_CHECK(queue->getSize() == 2);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
+}
+
+BOOST_AUTO_TEST_CASE(shutDownException)
+{
+    TestListenerPtr listener(new TestListener);
+    SuspendableQueuePtr queue(new SuspendableWorkQueue(listener));
+
+    queue->shutDown();
+
+    bool excepted;
+    try
+    {
+        queue->getSize();
+    }
+    catch (ShuttingDown)
+    {
+        excepted = true;
+    }
+    BOOST_CHECK(excepted == true);
+
+    excepted = false;
+    SimpleTaskPtr work(new SimpleTask);
+    try
+    {
+        queue->enqueueWork(work);
+    }
+    catch (ShuttingDown)
+    {
+        excepted = true;
+    }
+    BOOST_CHECK(excepted == true);
+    excepted = false;
+
+    try
+    {
+        queue->executeWork();
+    }
+    catch (ShuttingDown)
+    {
+        excepted = true;
+    }
+    BOOST_CHECK(excepted == true);
+    excepted = false;
+
+    try
+    {
+        queue->cancelWork(work);
+    }
+    catch (ShuttingDown)
+    {
+        excepted = true;
+    }
+    BOOST_CHECK(excepted == true);
+    excepted = false;
+
+    try
+    {
+        queue->setListener(listener);
+    }
+    catch (ShuttingDown)
+    {
+        excepted = true;
+    }
+    BOOST_CHECK(excepted == true);
+    excepted = false;
+
+    try
+    {
+        queue->shutDown();
+    }
+    catch (ShuttingDown)
+    {
+        excepted = true;
+    }
+    BOOST_CHECK(excepted == true);
+
 }
 
 BOOST_AUTO_TEST_CASE(appendWork)
@@ -219,6 +310,10 @@ BOOST_AUTO_TEST_CASE(appendWork)
     BOOST_CHECK(listener->addedEmptyNotice == false);
     BOOST_CHECK(listener->emptyNotice == false);
     BOOST_CHECK(queue->getSize() == 2);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
 }
 
 BOOST_AUTO_TEST_CASE(cancelWork)
@@ -242,6 +337,10 @@ BOOST_AUTO_TEST_CASE(cancelWork)
     BOOST_CHECK(excepted == false);
     BOOST_CHECK(listener->emptyNotice == true);
     BOOST_CHECK(queue->getSize() == 0);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
 }
 
 BOOST_AUTO_TEST_CASE(cancelNonExistent1)
@@ -265,6 +364,10 @@ BOOST_AUTO_TEST_CASE(cancelNonExistent1)
     BOOST_CHECK(listener->addedEmptyNotice == false);
     BOOST_CHECK(listener->emptyNotice == false);
     BOOST_CHECK(queue->getSize() == 0);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
 }
 
 BOOST_AUTO_TEST_CASE(cancelNonExistent2)
@@ -288,6 +391,10 @@ BOOST_AUTO_TEST_CASE(cancelNonExistent2)
 
     BOOST_CHECK(excepted == false);
     BOOST_CHECK(queue->getSize() == 1);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
 }
 
 BOOST_AUTO_TEST_CASE(simpleWorkExecution)
@@ -303,6 +410,10 @@ BOOST_AUTO_TEST_CASE(simpleWorkExecution)
     BOOST_CHECK(work->taskExecuted == true);
     BOOST_CHECK(listener->emptyNotice == true);
     BOOST_CHECK(queue->getSize() == 0);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
 }
 
 BOOST_AUTO_TEST_CASE(executeNonExistent)
@@ -315,6 +426,10 @@ BOOST_AUTO_TEST_CASE(executeNonExistent)
     BOOST_CHECK(moreWork == false);
     BOOST_CHECK(queue->getSize() == 0);
     BOOST_CHECK(listener->emptyNotice == false);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
 }
 
 BOOST_AUTO_TEST_CASE(executionOrder1)
@@ -339,6 +454,10 @@ BOOST_AUTO_TEST_CASE(executionOrder1)
     BOOST_CHECK(work2->taskExecuted == true);
     BOOST_CHECK(listener->emptyNotice == true);
     BOOST_CHECK(queue->getSize() == 0);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
 }
 
 BOOST_AUTO_TEST_CASE(executionOrder2)
@@ -387,6 +506,10 @@ BOOST_AUTO_TEST_CASE(executionOrder2)
     BOOST_CHECK(work4->taskExecuted == true);
     BOOST_CHECK(listener->emptyNotice == true);
     BOOST_CHECK(queue->getSize() == 0);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
 }
 
 // Begin unique SuspendableWorkQueue tests
@@ -457,6 +580,10 @@ BOOST_AUTO_TEST_CASE(complexWork)
     BOOST_CHECK(queue->getSize() == 0);
     BOOST_CHECK(work->currentState == ComplexTask::Task2Complete);
     BOOST_CHECK(listener->emptyNotice == true);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
 }
 
 BOOST_AUTO_TEST_CASE(racyWork)
@@ -484,6 +611,10 @@ BOOST_AUTO_TEST_CASE(racyWork)
     BOOST_CHECK(work->currentState == RacyTask::Task2Complete);
     BOOST_CHECK(queue->getSize() == 0);
     BOOST_CHECK(listener->emptyNotice == true);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/test/WorkQueue/TestWorkQueue.cpp b/test/WorkQueue/TestWorkQueue.cpp
index 535cece..3f60bb4 100644
--- a/test/WorkQueue/TestWorkQueue.cpp
+++ b/test/WorkQueue/TestWorkQueue.cpp
@@ -29,7 +29,7 @@ public:
     TestListener()
         : tasksAdded(0), addedNotice(false),
         addedEmptyNotice(false),
-        emptyNotice(false) { }
+        emptyNotice(false), shutdownNotice(false) { }
 
     void workAdded(Ice::Long numNewWork, bool wasEmpty)
     {
@@ -47,11 +47,17 @@ public:
     {
         BOOST_FAIL("workResumable called from a Queue?!");
     }
+    
+    void shuttingDown()
+    {
+        shutdownNotice = true;
+    }
 
     Ice::Long tasksAdded;
     bool addedNotice;
     bool addedEmptyNotice;
     bool emptyNotice;
+    bool shutdownNotice;
 };
 
 typedef IceUtil::Handle<TestListener> TestListenerPtr;
@@ -105,6 +111,85 @@ BOOST_AUTO_TEST_CASE(addWork)
     BOOST_CHECK(listener->addedEmptyNotice == true);
     BOOST_CHECK(listener->tasksAdded == 1);
     BOOST_CHECK(queue->getSize() == 1);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
+}
+
+BOOST_AUTO_TEST_CASE(shutDownException)
+{
+    TestListenerPtr listener(new TestListener);
+    QueuePtr queue(new WorkQueue(listener));
+
+    queue->shutDown();
+
+    bool excepted;
+    try
+    {
+        queue->getSize();
+    }
+    catch (ShuttingDown)
+    {
+        excepted = true;
+    }
+    BOOST_CHECK(excepted == true);
+
+    excepted = false;
+    TaskPtr work(new Task);
+    try
+    {
+        queue->enqueueWork(work);
+    }
+    catch (ShuttingDown)
+    {
+        excepted = true;
+    }
+    BOOST_CHECK(excepted == true);
+    excepted = false;
+
+    try
+    {
+        queue->executeWork();
+    }
+    catch (ShuttingDown)
+    {
+        excepted = true;
+    }
+    BOOST_CHECK(excepted == true);
+    excepted = false;
+
+    try
+    {
+        queue->cancelWork(work);
+    }
+    catch (ShuttingDown)
+    {
+        excepted = true;
+    }
+    BOOST_CHECK(excepted == true);
+    excepted = false;
+
+    try
+    {
+        queue->setListener(listener);
+    }
+    catch (ShuttingDown)
+    {
+        excepted = true;
+    }
+    BOOST_CHECK(excepted == true);
+    excepted = false;
+
+    try
+    {
+        queue->shutDown();
+    }
+    catch (ShuttingDown)
+    {
+        excepted = true;
+    }
+    BOOST_CHECK(excepted == true);
 }
 
 BOOST_AUTO_TEST_CASE(addWorkSeq)
@@ -124,6 +209,10 @@ BOOST_AUTO_TEST_CASE(addWorkSeq)
     BOOST_CHECK(listener->emptyNotice == false);
     BOOST_CHECK(listener->tasksAdded == 2);
     BOOST_CHECK(queue->getSize() == 2);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
 }
 
 BOOST_AUTO_TEST_CASE(appendWork)
@@ -143,6 +232,10 @@ BOOST_AUTO_TEST_CASE(appendWork)
     BOOST_CHECK(listener->emptyNotice == false);
     BOOST_CHECK(listener->tasksAdded == 1);
     BOOST_CHECK(queue->getSize() == 2);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
 }
 
 BOOST_AUTO_TEST_CASE(cancelWork)
@@ -157,6 +250,10 @@ BOOST_AUTO_TEST_CASE(cancelWork)
 
     BOOST_CHECK(listener->emptyNotice == true);
     BOOST_CHECK(queue->getSize() == 0);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
 }
 
 BOOST_AUTO_TEST_CASE(cancelNonExistent1)
@@ -171,6 +268,10 @@ BOOST_AUTO_TEST_CASE(cancelNonExistent1)
     BOOST_CHECK(listener->addedEmptyNotice == false);
     BOOST_CHECK(listener->emptyNotice == false);
     BOOST_CHECK(queue->getSize() == 0);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
 }
 
 BOOST_AUTO_TEST_CASE(cancelNonExistent2)
@@ -185,6 +286,10 @@ BOOST_AUTO_TEST_CASE(cancelNonExistent2)
     queue->cancelWork(work2);
 
     BOOST_CHECK(queue->getSize() == 1);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
 }
 
 BOOST_AUTO_TEST_CASE(workExecution)
@@ -200,6 +305,10 @@ BOOST_AUTO_TEST_CASE(workExecution)
     BOOST_CHECK(work->taskExecuted == true);
     BOOST_CHECK(listener->emptyNotice == true);
     BOOST_CHECK(queue->getSize() == 0);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
 }
 
 BOOST_AUTO_TEST_CASE(executeNonExistent)
@@ -212,6 +321,10 @@ BOOST_AUTO_TEST_CASE(executeNonExistent)
     BOOST_CHECK(moreWork == false);
     BOOST_CHECK(queue->getSize() == 0);
     BOOST_CHECK(listener->emptyNotice == false);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
 }
 
 BOOST_AUTO_TEST_CASE(executionOrder1)
@@ -236,6 +349,10 @@ BOOST_AUTO_TEST_CASE(executionOrder1)
     BOOST_CHECK(work2->taskExecuted == true);
     BOOST_CHECK(listener->emptyNotice == true);
     BOOST_CHECK(queue->getSize() == 0);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
 }
 
 BOOST_AUTO_TEST_CASE(executionOrder2)
@@ -284,6 +401,10 @@ BOOST_AUTO_TEST_CASE(executionOrder2)
     BOOST_CHECK(work4->taskExecuted == true);
     BOOST_CHECK(listener->emptyNotice == true);
     BOOST_CHECK(queue->getSize() == 0);
+
+    queue->shutDown();
+
+    BOOST_CHECK(listener->shutdownNotice == true);
 }
 
 void waitForTaskCompletion(NotifyTaskPtr& task)

commit f1ba89aa404fe8e47887d8d9af2692187b9b9c44
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Wed Jun 1 17:04:46 2011 -0500

    We need to install the ice-util-cpp library.

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ee4c94e..c6cc0d8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -34,5 +34,5 @@ asterisk_scf_component_add_boost_libraries(ice-util-cpp core thread date_time)
 asterisk_scf_component_build_library(ice-util-cpp)
 target_link_libraries(ice-util-cpp logging-client)
 target_link_libraries(ice-util-cpp asterisk-scf-api)
+asterisk_scf_component_install(ice-util-cpp)
 
-# don't install the component.  it's just there to make Visual Studio happy

commit da775eff48a280c9c4a4ffc909f348e8b6fedf17
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Wed Jun 1 16:57:22 2011 -0500

    More CMake script cleanup.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 74b1a43..3690011 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,14 +1,9 @@
 asterisk_scf_project(ice-util-cpp 3.4)
 
-if (integrated_build STREQUAL "true")
-  set(utils_dir ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
-endif()
+set(ice-util-cpp_dir ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
 
 include_directories(include)
 include_directories(${API_INCLUDE_DIR})
-if(NOT logger_dir)
-   message(FATAL_ERROR "The logger directory could not be found ${logger_dir}")
-endif()
 include_directories(${logger_dir}/include)
 asterisk_scf_slice_include_directories(${API_SLICE_DIR})
 
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 61a4ebf..ee4c94e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,11 +1,3 @@
-#
-# Asterisk Scalable Communications Framework
-#
-# Copyright (C) 2010 -- Digium, Inc.
-#
-# All rights reserved.
-#
-
 # Ice Utilities for C++
 
 asterisk_scf_component_init(ice-util-cpp)
diff --git a/src/ThreadPool/CMakeLists.txt b/src/ThreadPool/CMakeLists.txt
index 28fd27f..f20e468 100644
--- a/src/ThreadPool/CMakeLists.txt
+++ b/src/ThreadPool/CMakeLists.txt
@@ -1,11 +1,3 @@
-#
-# Asterisk Scalable Communications Framework
-#
-# Copyright (C) 2011 -- Digium, Inc.
-#
-# All rights reserved.
-#
-
 asterisk_scf_component_init(ThreadPool)
 asterisk_scf_component_add_file(ThreadPool ../include/AsteriskSCF/ThreadPool.h)
 asterisk_scf_component_add_file(ThreadPool ../include/AsteriskSCF/WorkerThread.h)
@@ -15,3 +7,4 @@ asterisk_scf_component_add_boost_libraries(ThreadPool thread date_time)
 asterisk_scf_component_build_library(ThreadPool)
 target_link_libraries(ThreadPool WorkQueue)
 target_link_libraries(ThreadPool asterisk-scf-api)
+asterisk_scf_component_install(ThreadPool)
diff --git a/src/WorkQueue/CMakeLists.txt b/src/WorkQueue/CMakeLists.txt
index d642f69..6ca491d 100644
--- a/src/WorkQueue/CMakeLists.txt
+++ b/src/WorkQueue/CMakeLists.txt
@@ -1,11 +1,3 @@
-#
-# Asterisk Scalable Communications Framework
-#
-# Copyright (C) 2011 -- Digium, Inc.
-#
-# All rights reserved.
-#
-
 asterisk_scf_component_init(WorkQueue)
 asterisk_scf_component_add_file(WorkQueue ../include/AsteriskSCF/WorkQueue.h)
 asterisk_scf_component_add_file(WorkQueue ../include/AsteriskSCF/SuspendableWorkQueue.h)
diff --git a/test/ThreadPool/CMakeLists.txt b/test/ThreadPool/CMakeLists.txt
index f7a2c70..ec1a786 100644
--- a/test/ThreadPool/CMakeLists.txt
+++ b/test/ThreadPool/CMakeLists.txt
@@ -1,13 +1,3 @@
-#
-# Asterisk Scalable Communications Framework
-#
-# Copyright (C) 2011 -- Digium, Inc.
-#
-# All rights reserved.
-#
-
-include_directories(../../src/ThreadPool)
-
 asterisk_scf_component_init(ThreadPoolTest)
 asterisk_scf_component_add_file(ThreadPoolTest TestThreadPool.cpp)
 asterisk_scf_component_add_file(ThreadPoolTest test.cpp)
diff --git a/test/WorkQueue/CMakeLists.txt b/test/WorkQueue/CMakeLists.txt
index 8747c05..c0006f4 100644
--- a/test/WorkQueue/CMakeLists.txt
+++ b/test/WorkQueue/CMakeLists.txt
@@ -1,13 +1,3 @@
-#
-# Asterisk Scalable Communications Framework
-#
-# Copyright (C) 2011 -- Digium, Inc.
-#
-# All rights reserved.
-#
-
-include_directories(../../src/WorkQueue)
-
 asterisk_scf_component_init(WorkQueueTest)
 asterisk_scf_component_add_file(WorkQueueTest TestWorkQueue.cpp)
 asterisk_scf_component_add_file(WorkQueueTest test.cpp)
@@ -15,6 +5,7 @@ asterisk_scf_component_add_boost_libraries(WorkQueueTest unit_test_framework)
 asterisk_scf_component_build_standalone(WorkQueueTest)
 target_link_libraries(WorkQueueTest asterisk-scf-api)
 target_link_libraries(WorkQueueTest ice-util-cpp)
+asterisk_scf_test_boost(WorkQueueTest)
 
 asterisk_scf_component_init(SuspendableWorkQueueTest)
 asterisk_scf_component_add_file(SuspendableWorkQueueTest TestSuspendableWorkQueue.cpp)
@@ -23,6 +14,4 @@ asterisk_scf_component_add_boost_libraries(SuspendableWorkQueueTest unit_test_fr
 asterisk_scf_component_build_standalone(SuspendableWorkQueueTest)
 target_link_libraries(SuspendableWorkQueueTest asterisk-scf-api)
 target_link_libraries(SuspendableWorkQueueTest ice-util-cpp)
-
-asterisk_scf_test_boost(WorkQueueTest)
 asterisk_scf_test_boost(SuspendableWorkQueueTest)

commit 0b44631d5135fe1ff99346ec991fd722b9785701
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Wed Jun 1 13:10:59 2011 -0500

    Get TestThreadPool, TestWorkQueue and TestSuspendableWorkQueue to actually
    compile and run

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index d81da48..b26ab49 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -14,4 +14,5 @@ target_link_libraries(ice-util-cpp-test asterisk-scf-api)
 
 add_subdirectory(Async)
 add_subdirectory(Replication)
-
+add_subdirectory(ThreadPool)
+add_subdirectory(WorkQueue)
diff --git a/test/ThreadPool/CMakeLists.txt b/test/ThreadPool/CMakeLists.txt
index eff9e7f..f7a2c70 100644
--- a/test/ThreadPool/CMakeLists.txt
+++ b/test/ThreadPool/CMakeLists.txt
@@ -6,31 +6,13 @@
 # All rights reserved.
 #
 
-asterisk_scf_component_init(ThreadPoolTest CXX)
-
-include_directories(${API_INCLUDE_DIR})
 include_directories(../../src/ThreadPool)
-# The test requires a work queue
-include_directories(../../include)
-
 
+asterisk_scf_component_init(ThreadPoolTest)
 asterisk_scf_component_add_file(ThreadPoolTest TestThreadPool.cpp)
 asterisk_scf_component_add_file(ThreadPoolTest test.cpp)
 asterisk_scf_component_add_boost_libraries(ThreadPoolTest unit_test_framework)
-
-# asterisk_scf_component_add_file(ProofOfConcept ProofOfConcept.cpp)
-# asterisk_scf_component_add_file(ProofOfConcept test.cpp)
-# asterisk_scf_component_add_boost_libraries(ProofOfConcept unit_test_framework)
-
 asterisk_scf_component_build_standalone(ThreadPoolTest)
 target_link_libraries(ThreadPoolTest asterisk-scf-api)
-target_link_libraries(ThreadPoolTest ThreadPool)
-target_link_libraries(ThreadPoolTest WorkQueue)
-
-# asterisk_scf_component_build_standalone(ProofOfConcept)
-# target_link_libraries(ProofOfConcept asterisk-scf-api)
-# target_link_libraries(ProofOfConcept ThreadPool)
-# target_link_libraries(ProofOfConcept WorkQueue)
-
+target_link_libraries(ThreadPoolTest ice-util-cpp)
 asterisk_scf_test_boost(ThreadPoolTest)
-# asterisk_scf_test_boost(ProofOfConcept)
diff --git a/test/ThreadPool/TestThreadPool.cpp b/test/ThreadPool/TestThreadPool.cpp
index 8f2c2d7..05b032f 100644
--- a/test/ThreadPool/TestThreadPool.cpp
+++ b/test/ThreadPool/TestThreadPool.cpp
@@ -18,8 +18,8 @@
 #include <boost/thread.hpp>
 #include <boost/thread/locks.hpp>
 
-#include <AsteriskSCF/WorkQueue.h>
-#include <AsteriskSCF/ThreadPool.h>
+#include <AsteriskSCF/WorkQueue/WorkQueue.h>
+#include <AsteriskSCF/ThreadPool/ThreadPool.h>
 
 using namespace AsteriskSCF::System::ThreadPool::V1;
 using namespace AsteriskSCF::ThreadPool;
@@ -57,6 +57,14 @@ public:
         mEmptyNotice = true;
     }
 
+    void threadStart()
+    {
+    }
+
+    void threadStop()
+    {
+    }
+
     Ice::Long mActive;
     Ice::Long mIdle;
     Ice::Long mZombie;
diff --git a/test/WorkQueue/CMakeLists.txt b/test/WorkQueue/CMakeLists.txt
index 87185b4..8747c05 100644
--- a/test/WorkQueue/CMakeLists.txt
+++ b/test/WorkQueue/CMakeLists.txt
@@ -6,27 +6,23 @@
 # All rights reserved.
 #
 
-asterisk_scf_component_init(WorkQueueTest CXX)
-
-include_directories(${API_INCLUDE_DIR})
 include_directories(../../src/WorkQueue)
-include_directories(../../include)
 
+asterisk_scf_component_init(WorkQueueTest)
 asterisk_scf_component_add_file(WorkQueueTest TestWorkQueue.cpp)
 asterisk_scf_component_add_file(WorkQueueTest test.cpp)
 asterisk_scf_component_add_boost_libraries(WorkQueueTest unit_test_framework)
-
 asterisk_scf_component_build_standalone(WorkQueueTest)
 target_link_libraries(WorkQueueTest asterisk-scf-api)
-target_link_libraries(WorkQueueTest WorkQueue)
+target_link_libraries(WorkQueueTest ice-util-cpp)
 
+asterisk_scf_component_init(SuspendableWorkQueueTest)
 asterisk_scf_component_add_file(SuspendableWorkQueueTest TestSuspendableWorkQueue.cpp)
 asterisk_scf_component_add_file(SuspendableWorkQueueTest test2.cpp)
 asterisk_scf_component_add_boost_libraries(SuspendableWorkQueueTest unit_test_framework thread)
-
 asterisk_scf_component_build_standalone(SuspendableWorkQueueTest)
 target_link_libraries(SuspendableWorkQueueTest asterisk-scf-api)
-target_link_libraries(SuspendableWorkQueueTest WorkQueue)
+target_link_libraries(SuspendableWorkQueueTest ice-util-cpp)
 
 asterisk_scf_test_boost(WorkQueueTest)
 asterisk_scf_test_boost(SuspendableWorkQueueTest)
diff --git a/test/WorkQueue/TestSuspendableWorkQueue.cpp b/test/WorkQueue/TestSuspendableWorkQueue.cpp
index 9894193..78276ee 100644
--- a/test/WorkQueue/TestSuspendableWorkQueue.cpp
+++ b/test/WorkQueue/TestSuspendableWorkQueue.cpp
@@ -17,7 +17,7 @@
 #include <boost/test/unit_test.hpp>
 #include <boost/thread.hpp>
 
-#include <AsteriskSCF/SuspendableWorkQueue.h>
+#include <AsteriskSCF/WorkQueue/SuspendableWorkQueue.h>
 
 using namespace AsteriskSCF::System::WorkQueue::V1;
 using namespace AsteriskSCF::WorkQueue;
diff --git a/test/WorkQueue/TestWorkQueue.cpp b/test/WorkQueue/TestWorkQueue.cpp
index 08a9cea..535cece 100644
--- a/test/WorkQueue/TestWorkQueue.cpp
+++ b/test/WorkQueue/TestWorkQueue.cpp
@@ -17,8 +17,8 @@
 #include <boost/test/unit_test.hpp>
 #include <boost/thread.hpp>
 
-#include <AsteriskSCF/WorkQueue.h>
-#include <AsteriskSCF/DefaultQueueListener.h>
+#include <AsteriskSCF/WorkQueue/WorkQueue.h>
+#include <AsteriskSCF/WorkQueue/DefaultQueueListener.h>
 
 using namespace AsteriskSCF::System::WorkQueue::V1;
 using namespace AsteriskSCF::WorkQueue;

commit 0c0f80099d313b7afb061c0edf1848a1260599fc
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Wed Jun 1 13:10:24 2011 -0500

    More CMake script cleanups, this time for the ice-util-cpp unit tests

diff --git a/test/Async/CMakeLists.txt b/test/Async/CMakeLists.txt
index 4079ce4..5477439 100644
--- a/test/Async/CMakeLists.txt
+++ b/test/Async/CMakeLists.txt
@@ -1,5 +1,3 @@
-include_directories("../src")
-
 asterisk_scf_component_init(ami-collector-test)
 asterisk_scf_component_add_file(ami-collector-test ResponseCollector-test.cpp)
 asterisk_scf_component_add_file(ami-collector-test IceIntegration-test.cpp)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 40b9f87..d81da48 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,19 +1,14 @@
-asterisk_scf_slice_include_directories(${API_SLICE_DIR})
-asterisk_scf_component_init(ice-util-cpp-test CXX)
-include_directories("../include")
-asterisk_scf_component_add_slice(ice-util-cpp-test ./ProxyHelper/SimpleIf.ice)
-asterisk_scf_component_add_file(ice-util-cpp-test ./LocatorRegistration/LocatorRegistrationTest.cpp)
-asterisk_scf_component_add_file(ice-util-cpp-test ./LocatorRegistration/LocatorRegistrationTest.h)
-asterisk_scf_component_add_file(ice-util-cpp-test ./PropertyHelper/PropertyHelperTest.cpp)
-asterisk_scf_component_add_file(ice-util-cpp-test ./PropertyHelper/PropertyHelperTest.h)
-asterisk_scf_component_add_file(ice-util-cpp-test ./ProxyHelper/ProxyHelperTests.cpp)
-asterisk_scf_component_add_file(ice-util-cpp-test ./ProxyHelper/ProxyHelperTests.h)
+asterisk_scf_component_init(ice-util-cpp-test)
+asterisk_scf_component_add_slice(ice-util-cpp-test ProxyHelper/SimpleIf.ice)
+asterisk_scf_component_add_file(ice-util-cpp-test LocatorRegistration/LocatorRegistrationTest.cpp)
+asterisk_scf_component_add_file(ice-util-cpp-test LocatorRegistration/LocatorRegistrationTest.h)
+asterisk_scf_component_add_file(ice-util-cpp-test PropertyHelper/PropertyHelperTest.cpp)
+asterisk_scf_component_add_file(ice-util-cpp-test PropertyHelper/PropertyHelperTest.h)
+asterisk_scf_component_add_file(ice-util-cpp-test ProxyHelper/ProxyHelperTests.cpp)
+asterisk_scf_component_add_file(ice-util-cpp-test ProxyHelper/ProxyHelperTests.h)
 asterisk_scf_component_add_file(ice-util-cpp-test UtilityTests.cpp)
-
 asterisk_scf_component_add_ice_libraries(ice-util-cpp-test IceBox)
 asterisk_scf_component_add_boost_libraries(ice-util-cpp-test unit_test_framework date_time thread)
-
-include_directories(${API_INCLUDE_DIR})
 asterisk_scf_component_build_icebox(ice-util-cpp-test)
 target_link_libraries(ice-util-cpp-test asterisk-scf-api)
 
diff --git a/test/Replication/CMakeLists.txt b/test/Replication/CMakeLists.txt
index d054323..829e50d 100644
--- a/test/Replication/CMakeLists.txt
+++ b/test/Replication/CMakeLists.txt
@@ -1,5 +1,3 @@
-include_directories("../include")
-
 asterisk_scf_component_init(StateReplicatorTest)
 asterisk_scf_component_add_file(StateReplicatorTest TestStateReplicator.cpp)
 asterisk_scf_component_add_file(StateReplicatorTest SharedTestData.h)

commit 5c2cfb8e126af44f886a835297e61c9f00099b44
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Wed Jun 1 11:25:12 2011 -0500

    Clean up CMake scripts:
    
    * Move common steps to top-level script
    * Remove duplicate function calls
    * Remove unnecessary function calls

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bbaf307..74b1a43 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,5 +4,15 @@ if (integrated_build STREQUAL "true")
   set(utils_dir ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
 endif()
 
+include_directories(include)
+include_directories(${API_INCLUDE_DIR})
+if(NOT logger_dir)
+   message(FATAL_ERROR "The logger directory could not be found ${logger_dir}")
+endif()
+include_directories(${logger_dir}/include)
+asterisk_scf_slice_include_directories(${API_SLICE_DIR})
+
 add_subdirectory(src)
 add_subdirectory(test)
+
+asterisk_scf_headers_install(include/)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5dc7319..61a4ebf 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -9,10 +9,6 @@
 # Ice Utilities for C++
 
 asterisk_scf_component_init(ice-util-cpp)
-
-include_directories(../include)
-asterisk_scf_slice_include_directories(${API_SLICE_DIR})
-
 asterisk_scf_component_add_file(ice-util-cpp ../include/AsteriskSCF/Discovery/SmartProxy.h)
 asterisk_scf_component_add_file(ice-util-cpp ../include/AsteriskSCF/Discovery/LocatorRegistrationWrapper.h)
 asterisk_scf_component_add_file(ice-util-cpp ../include/AsteriskSCF/Async/AmiCollector.h)
@@ -34,32 +30,17 @@ asterisk_scf_component_add_file(ice-util-cpp ThreadPool/ThreadPool.cpp)
 asterisk_scf_component_add_file(ice-util-cpp ThreadPool/WorkerThread.cpp)
 asterisk_scf_component_add_file(ice-util-cpp ../include/AsteriskSCF/CollocatedIceStorm/CollocatedIceStorm.h)
 asterisk_scf_component_add_file(ice-util-cpp CollocatedIceStorm/CollocatedIceStorm.cpp)
-
 #
 # Note, strictly speaking this isn't for component development, but as it is part of this
 # library it sort of belongs here.
 #
 asterisk_scf_component_add_file(ice-util-cpp ../include/AsteriskSCF/Testing/IceBoxBoostTest.h)
-
 asterisk_scf_component_add_file(ice-util-cpp IceUtilCpp.cpp)
-
 asterisk_scf_component_add_ice_libraries(ice-util-cpp IceStorm)
 asterisk_scf_component_add_ice_libraries(ice-util-cpp IceBox)
-
 asterisk_scf_component_add_boost_libraries(ice-util-cpp core thread date_time)
-
-if(NOT logger_dir)
-   message(FATAL_ERROR "The logger directory could not be found ${logger_dir}")
-endif()
-include_directories(${logger_dir}/include)
-include_directories(${API_INCLUDE_DIR})
-
 asterisk_scf_component_build_library(ice-util-cpp)
-
-include_directories(${API_INCLUDE_DIR})
 target_link_libraries(ice-util-cpp logging-client)
 target_link_libraries(ice-util-cpp asterisk-scf-api)
 
 # don't install the component.  it's just there to make Visual Studio happy
-# _do_ install the header files
-asterisk_scf_headers_install(include/)
diff --git a/src/ThreadPool/CMakeLists.txt b/src/ThreadPool/CMakeLists.txt
index 584d4d4..28fd27f 100644
--- a/src/ThreadPool/CMakeLists.txt
+++ b/src/ThreadPool/CMakeLists.txt
@@ -6,24 +6,12 @@
 # All rights reserved.
 #
 
-asterisk_scf_slice_include_directories(${API_SLICE_DIR})
-
-asterisk_scf_component_init(ThreadPool CXX)
-
-include_directories(../include)
-include_directories(../../WorkQueue/include)
-include_directories(${API_INCLUDE_DIR})
-
-asterisk_scf_component_add_file(ThreadPool
-    ../include/AsteriskSCF/ThreadPool.h)
-asterisk_scf_component_add_file(ThreadPool
-    ../include/AsteriskSCF/WorkerThread.h)
+asterisk_scf_component_init(ThreadPool)
+asterisk_scf_component_add_file(ThreadPool ../include/AsteriskSCF/ThreadPool.h)
+asterisk_scf_component_add_file(ThreadPool ../include/AsteriskSCF/WorkerThread.h)
 asterisk_scf_component_add_file(ThreadPool ThreadPool.cpp)
 asterisk_scf_component_add_file(ThreadPool WorkerThread.cpp)
 asterisk_scf_component_add_boost_libraries(ThreadPool thread date_time)
-
 asterisk_scf_component_build_library(ThreadPool)
 target_link_libraries(ThreadPool WorkQueue)
 target_link_libraries(ThreadPool asterisk-scf-api)
-
-asterisk_scf_headers_install(../include/)
diff --git a/src/WorkQueue/CMakeLists.txt b/src/WorkQueue/CMakeLists.txt
index 31d8d88..d642f69 100644
--- a/src/WorkQueue/CMakeLists.txt
+++ b/src/WorkQueue/CMakeLists.txt
@@ -6,26 +6,14 @@
 # All rights reserved.
 #
 
-asterisk_scf_slice_include_directories(${API_SLICE_DIR})
-
-asterisk_scf_component_init(WorkQueue CXX)
-
-include_directories(../include)
-include_directories(${API_INCLUDE_DIR})
-
-asterisk_scf_component_add_file(WorkQueue
-    ../include/AsteriskSCF/WorkQueue.h)
-asterisk_scf_component_add_file(WorkQueue
-    ../include/AsteriskSCF/SuspendableWorkQueue.h)
-asterisk_scf_component_add_file(WorkQueue
-    ../include/AsteriskSCF/DefaultQueueListener.h)
+asterisk_scf_component_init(WorkQueue)
+asterisk_scf_component_add_file(WorkQueue ../include/AsteriskSCF/WorkQueue.h)
+asterisk_scf_component_add_file(WorkQueue ../include/AsteriskSCF/SuspendableWorkQueue.h)
+asterisk_scf_component_add_file(WorkQueue ../include/AsteriskSCF/DefaultQueueListener.h)
 asterisk_scf_component_add_file(WorkQueue WorkQueue.cpp)
 asterisk_scf_component_add_file(WorkQueue SuspendableWorkQueue.cpp)
 asterisk_scf_component_add_file(WorkQueue DefaultQueueListener.cpp)
 asterisk_scf_component_add_boost_libraries(WorkQueue thread date_time)
-
 asterisk_scf_component_build_library(WorkQueue)
 target_link_libraries(WorkQueue asterisk-scf-api)
-
-asterisk_scf_headers_install(../include/)
 asterisk_scf_component_install(WorkQueue)

commit 4e628d126cdbdcce2d0e45206f0c02bbbc1eaef7
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon May 23 19:15:37 2011 -0300

    Add required exports as the great Mark Michelson said.

diff --git a/include/AsteriskSCF/CollocatedIceStorm/CollocatedIceStorm.h b/include/AsteriskSCF/CollocatedIceStorm/CollocatedIceStorm.h
index f135838..02ea2b4 100644
--- a/include/AsteriskSCF/CollocatedIceStorm/CollocatedIceStorm.h
+++ b/include/AsteriskSCF/CollocatedIceStorm/CollocatedIceStorm.h
@@ -32,7 +32,7 @@ namespace CollocatedIceStorm
  * a separate process to access IceStorm services.
  */
 
-class CollocatedIceStorm : public IceUtil::Shared
+class ASTERISK_SCF_ICEBOX_EXPORT CollocatedIceStorm : public IceUtil::Shared
 {
 public:
     CollocatedIceStorm(const std::string&, const Ice::PropertiesPtr&);
diff --git a/src/CollocatedIceStorm/CollocatedIceStorm.cpp b/src/CollocatedIceStorm/CollocatedIceStorm.cpp
index 8903918..e3fe6c2 100644
--- a/src/CollocatedIceStorm/CollocatedIceStorm.cpp
+++ b/src/CollocatedIceStorm/CollocatedIceStorm.cpp
@@ -69,7 +69,7 @@ CollocatedIceStorm::~CollocatedIceStorm()
     }
 }
 
-void CollocatedIceStorm::stop()
+ASTERISK_SCF_ICEBOX_EXPORT void CollocatedIceStorm::stop()
 {
     //
     // NOTE: there isn't any mutex protection here. It can be added later if needed, but at the moment multiple threads

commit 0baaf07a662a1157210edfceac5c510cd07e7ed7
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon May 23 19:03:20 2011 -0300

    Please, please, fix building on Windows.

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 79698d6..5dc7319 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -42,6 +42,10 @@ asterisk_scf_component_add_file(ice-util-cpp CollocatedIceStorm/CollocatedIceSto
 asterisk_scf_component_add_file(ice-util-cpp ../include/AsteriskSCF/Testing/IceBoxBoostTest.h)
 
 asterisk_scf_component_add_file(ice-util-cpp IceUtilCpp.cpp)
+
+asterisk_scf_component_add_ice_libraries(ice-util-cpp IceStorm)
+asterisk_scf_component_add_ice_libraries(ice-util-cpp IceBox)
+
 asterisk_scf_component_add_boost_libraries(ice-util-cpp core thread date_time)
 
 if(NOT logger_dir)

commit 270fd2ef3b8309ac10c022e605b3b7651810c1d9
Merge: 9967956 c857c09
Author: Mark Michelson <mmichelson at digium.com>
Date:   Mon May 23 16:09:06 2011 -0500

    Merge branch 'master' of git.asterisk.org:asterisk-scf/release/ice-util-cpp


commit 9967956f986882c50ccba778a3f277eb782ab421
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu May 19 19:03:09 2011 -0500

    Implement new threadStart and threadStop calls.

diff --git a/include/AsteriskSCF/ThreadPool/WorkerThread.h b/include/AsteriskSCF/ThreadPool/WorkerThread.h
index 4597a11..6bf1a4d 100644
--- a/include/AsteriskSCF/ThreadPool/WorkerThread.h
+++ b/include/AsteriskSCF/ThreadPool/WorkerThread.h
@@ -84,6 +84,14 @@ public:
      * A zombie thread has died
      */
     virtual void zombieThreadDead(WorkerThreadPtr thread) = 0;
+    /**
+     * A new thread has been created
+     */
+    virtual void threadStarted() = 0;
+    /**
+     * A thread has finished its execution
+     */
+    virtual void threadFinished() = 0;
 };
 
 }; // end namespace ThreadPool
diff --git a/src/ThreadPool/ThreadPool.cpp b/src/ThreadPool/ThreadPool.cpp
index fb7e601..ac9aff3 100644
--- a/src/ThreadPool/ThreadPool.cpp
+++ b/src/ThreadPool/ThreadPool.cpp
@@ -196,6 +196,16 @@ public:
         }
     }
 
+    void threadStarted()
+    {
+        mListener->threadStart();
+    }
+
+    void threadFinished()
+    {
+        mListener->threadStop();
+    }
+
     /**
      * Queued task that causes the thread pool to gain or lose threads
      *
diff --git a/src/ThreadPool/WorkerThread.cpp b/src/ThreadPool/WorkerThread.cpp
index 6f8b59f..d8a68b8 100644
--- a/src/ThreadPool/WorkerThread.cpp
+++ b/src/ThreadPool/WorkerThread.cpp
@@ -37,6 +37,7 @@ public:
 
     void active()
     {
+        mListener->threadStarted();
         /**
          * For all intents and purposes, localAlive
          * should evaluate to (mState == Alive). We use
@@ -64,6 +65,7 @@ public:
         {
             mListener->zombieThreadDead(mWorkerThread);
         }
+        mListener->threadFinished();
     }
 
     bool idle()

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/ice-util-cpp.git



More information about the asterisk-scf-commits mailing list