[asterisk-scf-commits] asterisk-scf/integration/ice-util-cpp.git branch "workqueue" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Sat Mar 19 11:46:48 CDT 2011
branch "workqueue" has been updated
via 19715894a0c1a53b16213155dddb5ef397288b80 (commit)
from fc35d57a2ee51e0ef9b679c4d4f7baeae2a031af (commit)
Summary of changes:
WorkQueue/src/SuspendableWorkQueue.cpp | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit 19715894a0c1a53b16213155dddb5ef397288b80
Author: Mark Michelson <mmichelson at digium.com>
Date: Sat Mar 19 11:45:36 2011 -0500
Get tests to pass by fixing some errors in SuspendableWorkQueue.cpp
First, order of operations was causing workCount() to always return
1 or 0. Second, not initializing the state of the queue caused
operations to behave unexpectedly.
diff --git a/WorkQueue/src/SuspendableWorkQueue.cpp b/WorkQueue/src/SuspendableWorkQueue.cpp
index 39a1ab0..a319bfe 100644
--- a/WorkQueue/src/SuspendableWorkQueue.cpp
+++ b/WorkQueue/src/SuspendableWorkQueue.cpp
@@ -30,9 +30,9 @@ class SuspendableWorkQueueImpl
{
public:
SuspendableWorkQueueImpl()
- : mListener(0) { }
+ : mListener(0), state(Ready), currentWork(0) { }
SuspendableWorkQueueImpl(const QueueListenerPtr &listener)
- : mListener(listener) { }
+ : mListener(listener), state(Ready), currentWork(0) { }
QueueListenerPtr mListener;
boost::mutex mLock;
@@ -323,7 +323,7 @@ bool SuspendableWorkQueue::executeWork()
int SuspendableWorkQueue::workCount()
{
boost::unique_lock<boost::mutex> lock(mImpl->mLock);
- return mImpl->q.size() + mImpl->currentWork ? 1 : 0;
+ return mImpl->q.size() + (mImpl->currentWork ? 1 : 0);
}
void SuspendableWorkQueue::setListener(const QueueListenerPtr &listener)
-----------------------------------------------------------------------
--
asterisk-scf/integration/ice-util-cpp.git
More information about the asterisk-scf-commits
mailing list