[asterisk-scf-commits] asterisk-scf/release/slice.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Apr 19 13:06:59 CDT 2011


branch "master" has been updated
       via  5b26f4b5105b12808c7fe6159a947b0be28be2e6 (commit)
       via  e077c00402daaa531633522876fe75f3b8f4bf8b (commit)
       via  20084e7794523ce2a8d631b3246868a00676e92d (commit)
       via  86ae6dcd9240f59c511281c63a4ee10f4d897473 (commit)
       via  b2f2ff479f36b49511c0ed021b488d7ca2996774 (commit)
       via  ca02bc78ac8a577b4b6b7267701b0c2f6b9c5d9a (commit)
       via  8e36ca4e38d9c05a52112233005739820d1d48c8 (commit)
       via  754feb2254c8e1fca87c77153d19c99f2415d582 (commit)
       via  97c62970be5412ecc69ba679e7cb57968fd64792 (commit)
       via  a790d38036eb58e1338e05377d85ba22424f1b5d (commit)
       via  7303842f83419759671508c0addaeaf45281bf11 (commit)
       via  c5e324b61fb53d05ccb174e521f523d5e56cc2ae (commit)
       via  ea4cc659bcdb66692356e01cc9244be1c9b98934 (commit)
       via  566a81e3cebf1f9b652136637d7dde6e63bd69f4 (commit)
       via  10e5d492b1801ff3c3260fc9aaff5a3676905285 (commit)
      from  c2f50ada09a97344830c244f5a875cb3b6527202 (commit)

Summary of changes:
 AsteriskSCF/System/ThreadPool/ThreadPoolIf.ice |  122 +++++++++++
 AsteriskSCF/System/WorkQueue/WorkQueueIf.ice   |  276 ++++++++++++++++++++++++
 2 files changed, 398 insertions(+), 0 deletions(-)
 create mode 100644 AsteriskSCF/System/ThreadPool/ThreadPoolIf.ice
 create mode 100644 AsteriskSCF/System/WorkQueue/WorkQueueIf.ice


- Log -----------------------------------------------------------------
commit 5b26f4b5105b12808c7fe6159a947b0be28be2e6
Merge: e077c00 c2f50ad
Author: Mark Michelson <mmichelson at digium.com>
Date:   Tue Apr 19 13:06:29 2011 -0500

    Merge branch 'master' of git.asterisk.org:asterisk-scf/release/slice


commit e077c00402daaa531633522876fe75f3b8f4bf8b
Merge: 5264bb1 20084e7
Author: Mark Michelson <mmichelson at digium.com>
Date:   Tue Apr 19 13:01:57 2011 -0500

    Merge branch 'workqueue'


commit 20084e7794523ce2a8d631b3246868a00676e92d
Author: Mark Michelson <mmichelson at digium.com>
Date:   Fri Apr 8 16:55:02 2011 -0500

    Add a new parameter to QueueListener for number of items added to the queue.

diff --git a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
index 21df756..f09ad14 100644
--- a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
+++ b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
@@ -39,10 +39,11 @@ module V1
         /**
          * Indicates work has been added to the Queue or SuspendableQueue
          *
+         * @param numNewWork The number of items of Work added to the queue
          * @param wasEmpty True if the queue was empty prior
          * to the addition of the work. False otherwise.
          */
-        void workAdded(bool wasEmpty);
+        void workAdded(int numNewWork, bool wasEmpty);
 
         /**
          * Indicates that suspended work may be resumed

commit 86ae6dcd9240f59c511281c63a4ee10f4d897473
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Apr 7 22:14:05 2011 -0500

    Add some documentation to thread pool and work queue interfaces.

diff --git a/AsteriskSCF/System/ThreadPool/ThreadPoolIf.ice b/AsteriskSCF/System/ThreadPool/ThreadPoolIf.ice
index ea40393..c3e9c9f 100644
--- a/AsteriskSCF/System/ThreadPool/ThreadPoolIf.ice
+++ b/AsteriskSCF/System/ThreadPool/ThreadPoolIf.ice
@@ -30,21 +30,86 @@ module ThreadPool
 module V1
 {
 
+    /**
+     * A thread pool
+     *
+     * The Pool maintains a Queue of Work to execute. Users of the
+     * Pool feed it Work by adding to this Queue directly.
+     */
     local interface Pool
     {
+        /**
+         * Set the number of threads in the Pool
+         *
+         * This method may be used to either add or
+         * remove threads from the pool.
+         *
+         * @param size The number of threads for the pool to be
+         * resized to.
+         */
         void setSize(int size);
+
+        /**
+         * Get a handle to the Pool's Queue
+         *
+         * @return The Pool's Queue
+         */
         AsteriskSCF::System::WorkQueue::V1::Queue getQueue();
     };
 
+    /**
+     * Listener for events from a Pool
+     * 
+     * All methods include as a parameter a handle to the Pool
+     * in case the listener wishes to alter the Pool as a result
+     * of the reported event.
+     */
     local interface PoolListener
     {
+        /**
+         * Indicates that the state of one or more of the Pool's threads has changed
+         *
+         * @param tpool A handle to the Pool
+         * @param activeThreads The number of active threads. Active threads are those
+         * that are currently executing work.
+         * @param idleThreads The number of idle threads. Idle threads are those that
+         * are currently waiting for work to be added.
+         * @param zombieThreads The number of zombie threads. Zombie threads are those
+         * that are still executing work but are marked for destruction as soon as they
+         * finish.
+         */
         void stateChanged(Pool tpool, int activeThreads, int idleThreads, int zombieThreads);
+
+        /**
+         * Indicates that the Pool's queue has had work added to it.
+         *
+         * @param tpool A handle to the Pool
+         * @param newWorkCount The number of new items added to the Queue
+         * @param wasEmpty True if the Queue was empty prior to the addition of
+         * new Work. False otherwise.
+         */
         void queueWorkAdded(Pool tpool, int newWorkCount, bool wasEmpty);
+
+        /**
+         * Indicates that the Pool's queue is empty
+         *
+         * @param tpool A handle to the Pool
+         */
         void queueEmptied(Pool tpool);
     };
     
+    /**
+     * Factory class for creating Pools
+     */
     local interface PoolFactory
     {
+        /**
+         * Creates a new Pool
+         *
+         * @param listener The PoolListener for the Pool to report events to
+         * @param wqueue The Queue for the ThreadPool to use internally
+         * @return A handle to the newly created Pool
+         */
         Pool createPool(PoolListener listener, AsteriskSCF::System::WorkQueue::V1::Queue wqueue);
     };
 
diff --git a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
index a14e043..21df756 100644
--- a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
+++ b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
@@ -28,71 +28,241 @@ module WorkQueue
 module V1
 {
     
+    /**
+     * Receiver of event notices from a Queue or SuspendableQueue
+     *
+     * It is safe to call any Queue or SuspendableQueue operations
+     * from within these methods.
+     */
     local interface QueueListener
     {
+        /**
+         * Indicates work has been added to the Queue or SuspendableQueue
+         *
+         * @param wasEmpty True if the queue was empty prior
+         * to the addition of the work. False otherwise.
+         */
         void workAdded(bool wasEmpty);
+
+        /**
+         * Indicates that suspended work may be resumed
+         *
+         * This method is only ever called by SuspendableQueues
+         */
         void workResumable();
+
+        /**
+         * Indicates that the Queue or SuspendableQueue is now empty
+         */
         void emptied();
     };
 
+    /**
+     * An item of Work
+     *
+     * Objects derived from this interface may only be
+     * used with Queues, not SuspendableQueues.
+     */
     local interface Work
     {
+        /**
+         * Execute a task
+         */
         void execute();
     };
 
     local sequence<Work> WorkSeq;
 
+    /**
+     * Exception thrown when attempting to cancel a work item that is
+     * not in a Queue or SuspendableQueue
+     */
     local exception WorkNotFound
     {
     };
 
+    /**
+     * A standard work queue
+     *
+     * Queues maintain a thread-safe FIFO of Work
+     */
     local interface Queue
     {
+        /**
+         * Enqueue a single item of Work
+         *
+         * @param item The item of Work to enqueue
+         */
         void enqueueWork(Work item);
+
+        /**
+         * Enqueue multiple items of Work atomically
+         *
+         * The items will be added in the same order they
+         * appear in the input sequence.
+         *
+         * @param items The sequence of Work to add to the Queue.
+         */
        	void enqueueWorkSeq(WorkSeq items);
+
+        /**
+         * Cancel a previously queued work item.
+         *
+         * Searches the queue for the specified work item. If found,
+         * the item is removed, otherwise WorkNotFound is thrown. Note
+         * that if multiple copies of a Work item are in the queue, only
+         * the frontmost one will be removed as a result of this method
+         * call.
+         *
+         * @param item The item to be canceled
+         */
        	void cancelWork(Work item) throws WorkNotFound;
 
-        /* return value indicates whether queue contains more work
-       	   that can be executed immediately
-       	*/
+        /**
+         * Pop the front item from the queue and call its execute() method
+         *
+         * @retval true The queue contains more Work to be executed
+         * @retval false The queue contains no more Work objects
+         */
        	bool executeWork();
-       	/* this is a snapshot and should only be used as a hint */
+        /**
+         * Obtain a snapshot of the number of items in the Queue.
+         *
+         * Given that multiple threads may be adding and removing
+         * items from the queue, this should be taken as a hint of
+         * how many items there are rather than as gospel.
+         *
+         * @return The number of Work objects in the Queue
+         */
        	int getSize();
 
+        /**
+         * Set a new QueueListener
+         *
+         * If the Queue currently has a listener, then the new
+         * one will replace its old listener.
+         *
+         * @param listener The new QueueListener to set
+         */
         void setListener(QueueListener listener);
     };
 
+    /**
+     * The set of potential results from executing SuspendableWork
+     */
     enum SuspendableWorkResult
     {
+        /**
+         * Work has finished.
+         */
         Complete,
+        /**
+         * Work could not be completed immediately
+         */
        	Suspended
     };
 
+    /**
+     * Listens for updates from SuspendableWork objects
+     */
     local interface SuspendableWorkListener
     {
+        /**
+         * Indicates that suspended SuspendableWork may be resumed
+         */
         void workResumable();
     };
 
+    /**
+     * Work items to be used in a SuspendableQueue
+     */
     local interface SuspendableWork
     {
+        /**
+         * Executes a piece of SuspendableWork
+         *
+         * @param listener A SuspendableWorkListener to alert when the
+         * SuspendableWork may be resumed.
+         *
+         * @retval Complete The work has completed
+         * @retval Suspended The work cannot be completed at the moment
+         * The listener will be alerted when the SuspendableWork may be resumed.
+         */
         SuspendableWorkResult execute(SuspendableWorkListener listener);
     };
 
     local sequence<SuspendableWork> SuspendableWorkSeq;
 
+    /**
+     * A queue of SuspendableWork
+     *
+     * This is much like the Queue but allows for work to
+     * be suspended. This is useful for cases where an item
+     * of work makes an asynchronous RPC and does not wish to
+     * block the thread that is executing work.
+     */
     local interface SuspendableQueue
     {
+        /**
+         * Enqueue a single item of SuspendableWork
+         *
+         * @param item The item of work to enqueue
+         */
         void enqueueWork(SuspendableWork item);
+
+        /**
+         * Enqueue multiple items of SuspendableWork atomically
+         *
+         * The items will be added in the same order they
+         * appear in the input sequence.
+         *
+         * @param items The sequence of SuspendableWork to enqueue
+         */
        	void enqueueWorkSeq(SuspendableWorkSeq items);
+
+         /**
+         * Cancel a previously queued SuspendableWork item.
+         *
+         * Searches the queue for the specified work item. If found,
+         * the item is removed, otherwise WorkNotFound is thrown. Note
+         * that if multiple copies of a SuspendableWork item are in the
+         * queue, only the frontmost one will be removed as a result of
+         * this method call.
+         *
+         * @param item The item to be canceled
+         */
        	void cancelWork(SuspendableWork item) throws WorkNotFound;
        
-       	/* return value indicates whether queue contains more work
-       	   that can be executed immediately
-       	*/
+        /**
+         * Pop the front item from the queue and call its execute() method
+         *
+         * @retval true The queue contains more SuspendableWork that may
+         * be immediately executed
+         * @retval false The queue either contains no more SuspendableWork
+         * items OR the item executed returned a Suspended result.
+         */
        	bool executeWork();
-       	/* this is a snapshot and should only be used as a hint */
+
+        /**
+         * Obtain a snapshot of the number of items in the SuspendableQueue.
+         *
+         * Given that multiple threads may be adding and removing
+         * items from the queue, this should be taken as a hint of
+         * how many items there are rather than as gospel.
+         *
+         * @return The number of SuspendableWork objects in the
+         * SuspendableQueue
+         */
        	int getSize();
 
+        /**
+         * Set a new QueueListener
+         *
+         * If the SuspendableQueue currently has a listener, then the new
+         * one will replace its old listener.
+         *
+         * @param listener The new QueueListener to set
+         */
         void setListener(QueueListener listener);
     };
 

commit b2f2ff479f36b49511c0ed021b488d7ca2996774
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Mar 31 14:00:06 2011 -0500

    Address review comments.
    
    I could have sworn I did this already...

diff --git a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
index 13ffc1c..a14e043 100644
--- a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
+++ b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
@@ -46,15 +46,10 @@ module V1
     {
     };
 
-    local exception WorkExists
-    {
-        WorkSeq items;
-    };
-
     local interface Queue
     {
-        void enqueueWork(Work item) throws WorkExists;
-       	void enqueueWorkSeq(WorkSeq items) throws WorkExists;
+        void enqueueWork(Work item);
+       	void enqueueWorkSeq(WorkSeq items);
        	void cancelWork(Work item) throws WorkNotFound;
 
         /* return value indicates whether queue contains more work
@@ -62,7 +57,7 @@ module V1
        	*/
        	bool executeWork();
        	/* this is a snapshot and should only be used as a hint */
-       	int workCount();
+       	int getSize();
 
         void setListener(QueueListener listener);
     };
@@ -85,15 +80,10 @@ module V1
 
     local sequence<SuspendableWork> SuspendableWorkSeq;
 
-    local exception SuspendableWorkExists
-    {
-        SuspendableWorkSeq items;
-    };
-
     local interface SuspendableQueue
     {
-        void enqueueWork(SuspendableWork item) throws SuspendableWorkExists;
-       	void enqueueWorkSeq(SuspendableWorkSeq items) throws SuspendableWorkExists;
+        void enqueueWork(SuspendableWork item);
+       	void enqueueWorkSeq(SuspendableWorkSeq items);
        	void cancelWork(SuspendableWork item) throws WorkNotFound;
        
        	/* return value indicates whether queue contains more work
@@ -101,7 +91,7 @@ module V1
        	*/
        	bool executeWork();
        	/* this is a snapshot and should only be used as a hint */
-       	int workCount();
+       	int getSize();
 
         void setListener(QueueListener listener);
     };

commit ca02bc78ac8a577b4b6b7267701b0c2f6b9c5d9a
Author: Mark Michelson <mmichelson at digium.com>
Date:   Mon Mar 21 17:10:37 2011 -0500

    Add SuspendableWorkExists exception.

diff --git a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
index 7dcf6cb..13ffc1c 100644
--- a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
+++ b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
@@ -85,11 +85,16 @@ module V1
 
     local sequence<SuspendableWork> SuspendableWorkSeq;
 
+    local exception SuspendableWorkExists
+    {
+        SuspendableWorkSeq items;
+    };
+
     local interface SuspendableQueue
     {
-        void enqueueWork(SuspendableWork item);
-       	void enqueueWorkSeq(SuspendableWorkSeq items);
-       	void cancelWork(SuspendableWork item);
+        void enqueueWork(SuspendableWork item) throws SuspendableWorkExists;
+       	void enqueueWorkSeq(SuspendableWorkSeq items) throws SuspendableWorkExists;
+       	void cancelWork(SuspendableWork item) throws WorkNotFound;
        
        	/* return value indicates whether queue contains more work
        	   that can be executed immediately

commit 8e36ca4e38d9c05a52112233005739820d1d48c8
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Mar 16 16:53:34 2011 -0500

    Move the PoolListener definition below the Pool and change variable names so as not to confuse slice2cpp

diff --git a/AsteriskSCF/System/ThreadPool/ThreadPoolIf.ice b/AsteriskSCF/System/ThreadPool/ThreadPoolIf.ice
index 617e62d..ea40393 100644
--- a/AsteriskSCF/System/ThreadPool/ThreadPoolIf.ice
+++ b/AsteriskSCF/System/ThreadPool/ThreadPoolIf.ice
@@ -29,22 +29,23 @@ module ThreadPool
 
 module V1
 {
-    local interface PoolListener
-    {
-        void stateChanged(Pool pool, int activeThreads, int idleThreads, int zombieThreads);
-        void queueWorkAdded(Pool pool, int newWorkCount, bool wasEmpty);
-        void queueEmptied(Pool pool);
-    };
 
     local interface Pool
     {
         void setSize(int size);
         AsteriskSCF::System::WorkQueue::V1::Queue getQueue();
     };
+
+    local interface PoolListener
+    {
+        void stateChanged(Pool tpool, int activeThreads, int idleThreads, int zombieThreads);
+        void queueWorkAdded(Pool tpool, int newWorkCount, bool wasEmpty);
+        void queueEmptied(Pool tpool);
+    };
     
     local interface PoolFactory
     {
-        Pool createPool(PoolListener listener, AsteriskSCF::System::Workqueue::V1::Queue queue);
+        Pool createPool(PoolListener listener, AsteriskSCF::System::WorkQueue::V1::Queue wqueue);
     };
 
 }; /* End of V1 */

commit 754feb2254c8e1fca87c77153d19c99f2415d582
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Mar 16 16:50:00 2011 -0500

    Add some exceptions for work queues.

diff --git a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
index 561427f..7dcf6cb 100644
--- a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
+++ b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
@@ -42,11 +42,20 @@ module V1
 
     local sequence<Work> WorkSeq;
 
+    local exception WorkNotFound
+    {
+    };
+
+    local exception WorkExists
+    {
+        WorkSeq items;
+    };
+
     local interface Queue
     {
-        void enqueueWork(Work item);
-       	void enqueueWorkSeq(WorkSeq items);
-       	void cancelWork(Work item);
+        void enqueueWork(Work item) throws WorkExists;
+       	void enqueueWorkSeq(WorkSeq items) throws WorkExists;
+       	void cancelWork(Work item) throws WorkNotFound;
 
         /* return value indicates whether queue contains more work
        	   that can be executed immediately

commit 97c62970be5412ecc69ba679e7cb57968fd64792
Author: Mark Michelson <mmichelson at digium.com>
Date:   Tue Mar 8 10:38:51 2011 -0600

    Add a SuspendableWorkListener to detect when work may be resumed.

diff --git a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
index 9998c1e..561427f 100644
--- a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
+++ b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
@@ -64,9 +64,14 @@ module V1
        	Suspended
     };
 
+    local interface SuspendableWorkListener
+    {
+        void workResumable();
+    };
+
     local interface SuspendableWork
     {
-        SuspendableWorkResult execute();
+        SuspendableWorkResult execute(SuspendableWorkListener listener);
     };
 
     local sequence<SuspendableWork> SuspendableWorkSeq;

commit a790d38036eb58e1338e05377d85ba22424f1b5d
Author: Mark Michelson <mmichelson at digium.com>
Date:   Mon Mar 7 15:55:04 2011 -0600

    Change the execute method back to taking no parameter.

diff --git a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
index 7acb52a..9998c1e 100644
--- a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
+++ b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
@@ -66,7 +66,7 @@ module V1
 
     local interface SuspendableWork
     {
-        SuspendableWorkResult execute(SuspendableQueue queue);
+        SuspendableWorkResult execute();
     };
 
     local sequence<SuspendableWork> SuspendableWorkSeq;

commit 7303842f83419759671508c0addaeaf45281bf11
Author: Mark Michelson <mmichelson at digium.com>
Date:   Mon Mar 7 15:40:26 2011 -0600

    Add a few refinements to the SuspendableWorkQueue.
    
    This helps to further suggest a method by which suspended work
    can eventually let any worker threads know that the work can
    be resumed.

diff --git a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
index c6e7cb0..7acb52a 100644
--- a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
+++ b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
@@ -31,6 +31,7 @@ module V1
     local interface QueueListener
     {
         void workAdded(bool wasEmpty);
+        void workResumable();
         void emptied();
     };
 
@@ -65,7 +66,7 @@ module V1
 
     local interface SuspendableWork
     {
-        SuspendableWorkResult execute();
+        SuspendableWorkResult execute(SuspendableQueue queue);
     };
 
     local sequence<SuspendableWork> SuspendableWorkSeq;

commit c5e324b61fb53d05ccb174e521f523d5e56cc2ae
Author: Mark Michelson <mmichelson at digium.com>
Date:   Mon Mar 7 09:56:02 2011 -0600

    * Fix spacing in work queue and thread pool slice files.
    * Get rid of PoolManager interface in thread pool, placing the operations on the Pool itself instead.
    * Add a PoolFactory interface for thread pools.

diff --git a/AsteriskSCF/System/ThreadPool/ThreadPoolIf.ice b/AsteriskSCF/System/ThreadPool/ThreadPoolIf.ice
index e4bcd7a..617e62d 100644
--- a/AsteriskSCF/System/ThreadPool/ThreadPoolIf.ice
+++ b/AsteriskSCF/System/ThreadPool/ThreadPoolIf.ice
@@ -29,23 +29,22 @@ module ThreadPool
 
 module V1
 {
-    
-    local interface PoolManager
-    {
-	void setPoolSize(int size);
-    };
-
     local interface PoolListener
     {
-	void stateChanged(PoolManager manager, int activeThreads, int idleThreads, int zombieThreads);
-	void queueWorkAdded(PoolManager manager, int newWorkCount, bool wasEmpty);
-	void queueEmptied(PoolManager manager);
+        void stateChanged(Pool pool, int activeThreads, int idleThreads, int zombieThreads);
+        void queueWorkAdded(Pool pool, int newWorkCount, bool wasEmpty);
+        void queueEmptied(Pool pool);
     };
 
     local interface Pool
     {
-	void setWorkQueue(AsteriskSCF::System::WorkQueue::V1::Queue queue);
-	void setListener(PoolListener listener);
+        void setSize(int size);
+        AsteriskSCF::System::WorkQueue::V1::Queue getQueue();
+    };
+    
+    local interface PoolFactory
+    {
+        Pool createPool(PoolListener listener, AsteriskSCF::System::Workqueue::V1::Queue queue);
     };
 
 }; /* End of V1 */
diff --git a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
index bd481a9..c6e7cb0 100644
--- a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
+++ b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
@@ -30,58 +30,58 @@ module V1
     
     local interface QueueListener
     {
-	void workAdded(bool wasEmpty);
-	void emptied();
+        void workAdded(bool wasEmpty);
+        void emptied();
     };
 
     local interface Work
     {
-	void execute();
+        void execute();
     };
 
-    sequence<Work> WorkSeq;
+    local sequence<Work> WorkSeq;
 
     local interface Queue
     {
-	void enqueueWork(Work item);
-	void enqueueWorkSeq(WorkSeq items);
-	void cancelWork(Work item);
+        void enqueueWork(Work item);
+       	void enqueueWorkSeq(WorkSeq items);
+       	void cancelWork(Work item);
 
-	/* return value indicates whether queue contains more work
-	   that can be executed immediately
-	*/
-	bool executeWork();
-	/* this is a snapshot and should only be used as a hint */
-	int workCount();
+        /* return value indicates whether queue contains more work
+       	   that can be executed immediately
+       	*/
+       	bool executeWork();
+       	/* this is a snapshot and should only be used as a hint */
+       	int workCount();
 
         void setListener(QueueListener listener);
     };
 
     enum SuspendableWorkResult
     {
-	Complete,
-	Suspended
+        Complete,
+       	Suspended
     };
 
     local interface SuspendableWork
     {
-	SuspendableWorkResult execute();
+        SuspendableWorkResult execute();
     };
 
-    sequence<SuspendableWork> SuspendableWorkSeq;
+    local sequence<SuspendableWork> SuspendableWorkSeq;
 
     local interface SuspendableQueue
     {
-	void enqueueWork(SuspendableWork item);
-	void enqueueWorkSeq(SuspendableWorkSeq items);
-	void cancelWork(SuspendableWork item);
-
-	/* return value indicates whether queue contains more work
-	   that can be executed immediately
-	*/
-	bool executeWork();
-	/* this is a snapshot and should only be used as a hint */
-	int workCount();
+        void enqueueWork(SuspendableWork item);
+       	void enqueueWorkSeq(SuspendableWorkSeq items);
+       	void cancelWork(SuspendableWork item);
+       
+       	/* return value indicates whether queue contains more work
+       	   that can be executed immediately
+       	*/
+       	bool executeWork();
+       	/* this is a snapshot and should only be used as a hint */
+       	int workCount();
 
         void setListener(QueueListener listener);
     };

commit ea4cc659bcdb66692356e01cc9244be1c9b98934
Author: Mark Michelson <mmichelson at digium.com>
Date:   Mon Mar 7 09:22:27 2011 -0600

    Fix error in slice. You can't overload interface member names.

diff --git a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
index 29cdcc3..bd481a9 100644
--- a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
+++ b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
@@ -44,7 +44,7 @@ module V1
     local interface Queue
     {
 	void enqueueWork(Work item);
-	void enqueueWork(WorkSeq items);
+	void enqueueWorkSeq(WorkSeq items);
 	void cancelWork(Work item);
 
 	/* return value indicates whether queue contains more work
@@ -73,7 +73,7 @@ module V1
     local interface SuspendableQueue
     {
 	void enqueueWork(SuspendableWork item);
-	void enqueueWork(SuspendableWorkSeq items);
+	void enqueueWorkSeq(SuspendableWorkSeq items);
 	void cancelWork(SuspendableWork item);
 
 	/* return value indicates whether queue contains more work

commit 566a81e3cebf1f9b652136637d7dde6e63bd69f4
Author: Mark Michelson <mmichelson at digium.com>
Date:   Tue Mar 1 10:05:12 2011 -0600

    Add enqueue operations that take a sequence of work items.

diff --git a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
index ebd0caa..29cdcc3 100644
--- a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
+++ b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
@@ -39,9 +39,12 @@ module V1
 	void execute();
     };
 
+    sequence<Work> WorkSeq;
+
     local interface Queue
     {
 	void enqueueWork(Work item);
+	void enqueueWork(WorkSeq items);
 	void cancelWork(Work item);
 
 	/* return value indicates whether queue contains more work
@@ -65,9 +68,12 @@ module V1
 	SuspendableWorkResult execute();
     };
 
+    sequence<SuspendableWork> SuspendableWorkSeq;
+
     local interface SuspendableQueue
     {
 	void enqueueWork(SuspendableWork item);
+	void enqueueWork(SuspendableWorkSeq items);
 	void cancelWork(SuspendableWork item);
 
 	/* return value indicates whether queue contains more work

commit 10e5d492b1801ff3c3260fc9aaff5a3676905285
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Thu Feb 24 16:50:51 2011 -0600

    Initial definitions of new interfaces to be used as the standard
    for components needing work queues and thread pools (including
    suspendable work queues, designed for when work items need to be
    restarted after asynchronous operations complete). Wiki documentation
    to come soon...
    
    These were written by Mark Michelson and myself after quite a few hours
    of discussion with Brent Eagles and Ken Hunt. Collaborative design!

diff --git a/AsteriskSCF/System/ThreadPool/ThreadPoolIf.ice b/AsteriskSCF/System/ThreadPool/ThreadPoolIf.ice
new file mode 100644
index 0000000..e4bcd7a
--- /dev/null
+++ b/AsteriskSCF/System/ThreadPool/ThreadPoolIf.ice
@@ -0,0 +1,57 @@
+/*
+ * Asterisk SCF -- An open-source communications framework.
+ *
+ * Copyright (C) 2011, Digium, Inc.
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk SCF project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE.txt file
+ * at the top of the source tree.
+ */
+
+#pragma once
+
+#include <AsteriskSCF/System/WorkQueue/WorkQueueIf.ice>
+
+module AsteriskSCF
+{
+
+module System
+{
+
+module ThreadPool
+{
+
+module V1
+{
+    
+    local interface PoolManager
+    {
+	void setPoolSize(int size);
+    };
+
+    local interface PoolListener
+    {
+	void stateChanged(PoolManager manager, int activeThreads, int idleThreads, int zombieThreads);
+	void queueWorkAdded(PoolManager manager, int newWorkCount, bool wasEmpty);
+	void queueEmptied(PoolManager manager);
+    };
+
+    local interface Pool
+    {
+	void setWorkQueue(AsteriskSCF::System::WorkQueue::V1::Queue queue);
+	void setListener(PoolListener listener);
+    };
+
+}; /* End of V1 */
+
+}; /* End of ThreadPool */
+
+}; /* End of System */
+
+}; /* End of AsteriskSCF */
diff --git a/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
new file mode 100644
index 0000000..ebd0caa
--- /dev/null
+++ b/AsteriskSCF/System/WorkQueue/WorkQueueIf.ice
@@ -0,0 +1,89 @@
+/*
+ * Asterisk SCF -- An open-source communications framework.
+ *
+ * Copyright (C) 2011, Digium, Inc.
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk SCF project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE.txt file
+ * at the top of the source tree.
+ */
+
+#pragma once
+
+module AsteriskSCF
+{
+
+module System
+{
+
+module WorkQueue
+{
+
+module V1
+{
+    
+    local interface QueueListener
+    {
+	void workAdded(bool wasEmpty);
+	void emptied();
+    };
+
+    local interface Work
+    {
+	void execute();
+    };
+
+    local interface Queue
+    {
+	void enqueueWork(Work item);
+	void cancelWork(Work item);
+
+	/* return value indicates whether queue contains more work
+	   that can be executed immediately
+	*/
+	bool executeWork();
+	/* this is a snapshot and should only be used as a hint */
+	int workCount();
+
+        void setListener(QueueListener listener);
+    };
+
+    enum SuspendableWorkResult
+    {
+	Complete,
+	Suspended
+    };
+
+    local interface SuspendableWork
+    {
+	SuspendableWorkResult execute();
+    };
+
+    local interface SuspendableQueue
+    {
+	void enqueueWork(SuspendableWork item);
+	void cancelWork(SuspendableWork item);
+
+	/* return value indicates whether queue contains more work
+	   that can be executed immediately
+	*/
+	bool executeWork();
+	/* this is a snapshot and should only be used as a hint */
+	int workCount();
+
+        void setListener(QueueListener listener);
+    };
+
+}; /* End of V1 */
+
+}; /* End of WorkQueue */
+
+}; /* End of System */
+
+}; /* End of AsteriskSCF */

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


-- 
asterisk-scf/release/slice.git



More information about the asterisk-scf-commits mailing list