[asterisk-scf-commits] team/ken.hunt/route_async_routing.git branch "route_async" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Thu Dec 23 00:52:36 UTC 2010
branch "route_async" has been updated
via a52053b5f138ba4b26c9474c906d0e59df196379 (commit)
from d767903433ae98633a3f954ddb74af172227d6cd (commit)
Summary of changes:
src/SimpleWorkQueue.cpp | 94 +++++++++++++++++++++++-----------------------
1 files changed, 47 insertions(+), 47 deletions(-)
- Log -----------------------------------------------------------------
commit a52053b5f138ba4b26c9474c906d0e59df196379
Author: Ken Hunt <ken.hunt at digium.com>
Date: Wed Dec 22 18:52:25 2010 -0600
Format cleanup.
diff --git a/src/SimpleWorkQueue.cpp b/src/SimpleWorkQueue.cpp
index 4450deb..fc33deb 100644
--- a/src/SimpleWorkQueue.cpp
+++ b/src/SimpleWorkQueue.cpp
@@ -46,38 +46,38 @@ public:
mPaused(false), // runs by default.
mThread(boost::bind(&SimpleWorkQueuePriv::execute, this))
- {
- mLogger(Debug) << "SimpleWorkQueue::private_impl constructor called. Queue ID:" << mQid;
- }
-
- ~SimpleWorkQueuePriv()
- {
- mLogger(Debug) << "SimpleWorkQueue::private_impl desctuctor called. Queue ID:" << mQid;
- }
-
- WorkPtr dequeue();
- WorkPtr waitAndDequeue();
- void execute();
- bool isPaused();
-
- const Logger& mLogger;
- std::string mQid;
- bool mInitialized;
- bool mFinished;
- bool mPaused;
- boost::thread mThread;
- std::list<WorkPtr> mQueue;
- boost::mutex mQueueMutex;
- boost::condition mEmptyQueueCondition;
- boost::mutex mPauseMutex;
- boost::condition mPauseCondition;
+ {
+ mLogger(Debug) << "SimpleWorkQueue::private_impl constructor called. Queue ID:" << mQid;
+ }
+
+ ~SimpleWorkQueuePriv()
+ {
+ mLogger(Debug) << "SimpleWorkQueue::private_impl desctuctor called. Queue ID:" << mQid;
+ }
+
+ WorkPtr dequeue();
+ WorkPtr waitAndDequeue();
+ void execute();
+ bool isPaused();
+
+ const Logger& mLogger;
+ std::string mQid;
+ bool mInitialized;
+ bool mFinished;
+ bool mPaused;
+ boost::thread mThread;
+ std::list<WorkPtr> mQueue;
+ boost::mutex mQueueMutex;
+ boost::condition mEmptyQueueCondition;
+ boost::mutex mPauseMutex;
+ boost::condition mPauseCondition;
};
}
SimpleWorkQueue::SimpleWorkQueue(const std::string& qid, const Logger& logger) : mImpl(new SimpleWorkQueuePriv(qid, logger))
{
- mImpl->mLogger(Debug) << "SimpleWorkQueue::Constructor() called. Queue ID:" << mImpl->mQid;
- mImpl->mInitialized = true;
+ mImpl->mLogger(Debug) << "SimpleWorkQueue::Constructor() called. Queue ID:" << mImpl->mQid;
+ mImpl->mInitialized = true;
}
SimpleWorkQueue::~SimpleWorkQueue()
@@ -110,11 +110,11 @@ void SimpleWorkQueue::pause()
*/
void SimpleWorkQueue::resume()
{
- mImpl->mLogger(Info) << "SimpleWorkQueue::Resume called for queue " << mImpl->mQid;
+ mImpl->mLogger(Info) << "SimpleWorkQueue::Resume called for queue " << mImpl->mQid;
- boost::lock_guard<boost::mutex> lock(mImpl->mPauseMutex);
- mImpl->mPaused = false;
- mImpl->mPauseCondition.notify_all();
+ boost::lock_guard<boost::mutex> lock(mImpl->mPauseMutex);
+ mImpl->mPaused = false;
+ mImpl->mPauseCondition.notify_all();
}
/**
@@ -122,12 +122,12 @@ void SimpleWorkQueue::resume()
*/
void SimpleWorkQueue::terminate()
{
- mImpl->mLogger(Info) << "SimpleWorkQueue::Terminate called for queue " << mImpl->mQid ;
+ mImpl->mLogger(Info) << "SimpleWorkQueue::Terminate called for queue " << mImpl->mQid ;
- mImpl->mFinished = true;
- mImpl->mPaused = false;
- mImpl->mPauseCondition.notify_all(); // In case the thread was waiting on the PauseCondition.
- mImpl->mEmptyQueueCondition.notify_all(); // In case the thread was waiting on an EmptyQueueCondition
+ mImpl->mFinished = true;
+ mImpl->mPaused = false;
+ mImpl->mPauseCondition.notify_all(); // In case the thread was waiting on the PauseCondition.
+ mImpl->mEmptyQueueCondition.notify_all(); // In case the thread was waiting on an EmptyQueueCondition
}
/**
@@ -135,7 +135,7 @@ void SimpleWorkQueue::terminate()
*/
bool SimpleWorkQueue::workPending()
{
- return !mImpl->mQueue.empty();
+ return !mImpl->mQueue.empty();
}
/**
@@ -145,7 +145,7 @@ bool SimpleWorkQueue::workPending()
*/
void SimpleWorkQueue::join()
{
- mImpl->mThread.join();
+ mImpl->mThread.join();
}
static WorkQueue::PoolId mNoOpPoolId;
@@ -162,13 +162,13 @@ WorkQueue::PoolId SimpleWorkQueue::enqueue(const WorkPtr& w)
wasEmpty = mImpl->mQueue.empty();
mImpl->mQueue.push_back(w);
}
-
- if (wasEmpty)
- {
- mImpl->mEmptyQueueCondition.notify_all();
- }
- return mNoOpPoolId;
+ if (wasEmpty)
+ {
+ mImpl->mEmptyQueueCondition.notify_all();
+ }
+
+ return mNoOpPoolId;
}
/**
@@ -199,13 +199,13 @@ WorkPtr SimpleWorkQueuePriv::waitAndDequeue()
if (mFinished)
{
- mLogger(Info) << "SimpleWorkQueue::WaitAndDequeue: Returning the NO_WORK token. Queue ID:" << mQid;
- return NO_WORK_PTR;
+ mLogger(Info) << "SimpleWorkQueue::WaitAndDequeue: Returning the NO_WORK token. Queue ID:" << mQid;
+ return NO_WORK_PTR;
}
mEmptyQueueCondition.wait(lock);
}
-
+
mLogger(Debug) << "SimpleWorkQueue::WaitAndDequeue: Dequeuing some work. Queue ID:" << mQid;
size = mQueue.size(); // debugging
-----------------------------------------------------------------------
--
team/ken.hunt/route_async_routing.git
More information about the asterisk-scf-commits
mailing list