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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu May 19 19:45:20 CDT 2011


branch "threadhook" has been created
        at  9967956f986882c50ccba778a3f277eb782ab421 (commit)

- Log -----------------------------------------------------------------
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