hopefull correct all mutex lock mistakes
diff --git a/src/ccnx-tunnel.cpp b/src/ccnx-tunnel.cpp
index f428481..dfefc8b 100644
--- a/src/ccnx-tunnel.cpp
+++ b/src/ccnx-tunnel.cpp
@@ -68,7 +68,7 @@
// The interest must have m_localPrefix as a prefix (component-wise), otherwise ccnd would not deliver it to us
Name interest = tunneledInterest.getPartialName(m_localPrefix.size());
- ReadLock(m_ritLock);
+ ReadLock lock(m_ritLock);
// This is linear scan, but should be acceptable under the assumption that the caller wouldn't be listening to a lot prefixes (as of now, most app listen to one or two prefixes)
for (RitIter it = m_rit.begin(); it != m_rit.end(); it++)
@@ -104,7 +104,7 @@
int
CcnxTunnel::setInterestFilter(const Name &prefix, const InterestCallback &interestCallback)
{
- WriteLock(m_ritLock);
+ WriteLock lock(m_ritLock);
// make sure copy constructor for boost::function works properly
m_rit.insert(make_pair(prefix, interestCallback));
return 0;
@@ -113,7 +113,7 @@
void
CcnxTunnel::clearInterestFilter(const Name &prefix)
{
- WriteLock(m_ritLock);
+ WriteLock lock(m_ritLock);
// remove all
m_rit.erase(prefix);
}
diff --git a/src/event-scheduler.cpp b/src/event-scheduler.cpp
index 33697a5..f4603f0 100644
--- a/src/event-scheduler.cpp
+++ b/src/event-scheduler.cpp
@@ -156,7 +156,7 @@
{
cout << "scheduler loop break error" << endl;
}
- ReadLock(m_mutex);
+ ReadLock lock(m_mutex);
if (!m_running)
{
cout << "scheduler loop break normal" << endl;
@@ -169,7 +169,7 @@
Scheduler::start()
{
{
- WriteLock(m_mutex);
+ WriteLock lock(m_mutex);
m_running = true;
}
m_thread = boost::thread(&Scheduler::eventLoop, this);
@@ -179,7 +179,7 @@
Scheduler::shutdown()
{
{
- WriteLock(m_mutex);
+ WriteLock lock(m_mutex);
m_running = false;
}
event_base_loopbreak(m_base);
@@ -213,7 +213,7 @@
void
Scheduler::rescheduleTask(const Task::Tag &tag)
{
- ReadLock(m_mutex);
+ ReadLock lock(m_mutex);
TaskMapIt it = m_taskMap.find(tag);
if (it != m_taskMap.end())
{
@@ -230,7 +230,7 @@
bool
Scheduler::addToMap(const TaskPtr &task)
{
- WriteLock(m_mutex);
+ WriteLock lock(m_mutex);
if (m_taskMap.find(task->tag()) == m_taskMap.end())
{
m_taskMap.insert(make_pair(task->tag(), task));
@@ -242,7 +242,7 @@
void
Scheduler::deleteTask(const Task::Tag &tag)
{
- WriteLock(m_mutex);
+ WriteLock lock(m_mutex);
TaskMapIt it = m_taskMap.find(tag);
if (it != m_taskMap.end())
{
@@ -255,7 +255,7 @@
void
Scheduler::deleteTask(const Task::TaskMatcher &matcher)
{
- WriteLock(m_mutex);
+ WriteLock lock(m_mutex);
TaskMapIt it = m_taskMap.begin();
while(it != m_taskMap.end())
{
@@ -278,6 +278,6 @@
int
Scheduler::size()
{
- ReadLock(m_mutex);
+ ReadLock lock(m_mutex);
return m_taskMap.size();
}