Several mutex locking corrections (didn't check all of them)
diff --git a/src/ccnx-wrapper.cpp b/src/ccnx-wrapper.cpp
index 5580b03..637b9af 100644
--- a/src/ccnx-wrapper.cpp
+++ b/src/ccnx-wrapper.cpp
@@ -34,7 +34,7 @@
//}
m_handle = ccn_create ();
- UniqueRecLock(m_mutex);
+ UniqueRecLock lock(m_mutex);
if (ccn_connect(m_handle, NULL) < 0)
{
BOOST_THROW_EXCEPTION (CcnxOperationException() << errmsg_info_str("connection to ccnd failed"));
@@ -54,7 +54,7 @@
CcnxWrapper::~CcnxWrapper()
{
{
- UniqueRecLock(m_mutex);
+ UniqueRecLock lock(m_mutex);
m_running = false;
}
@@ -75,7 +75,7 @@
{
int res = 0;
{
- UniqueRecLock(m_mutex);
+ UniqueRecLock lock(m_mutex);
res = ccn_run (m_handle, 0);
}
@@ -88,7 +88,7 @@
pollfd pfds[1];
{
- UniqueRecLock(m_mutex);
+ UniqueRecLock lock(m_mutex);
pfds[0].fd = ccn_get_connection_fd (m_handle);
pfds[0].events = POLLIN;
@@ -174,7 +174,7 @@
int
CcnxWrapper::putToCcnd (const Bytes &contentObject)
{
- UniqueRecLock(m_mutex);
+ UniqueRecLock lock(m_mutex);
if (!m_running || !m_connected)
return -1;
@@ -288,7 +288,7 @@
int CcnxWrapper::sendInterest (const Name &interest, const Closure *closure, const Selectors &selectors)
{
- UniqueRecLock(m_mutex);
+ UniqueRecLock lock(m_mutex);
if (!m_running || !m_connected)
return -1;
@@ -317,7 +317,7 @@
int CcnxWrapper::setInterestFilter (const Name &prefix, const InterestCallback &interestCallback)
{
- UniqueRecLock(m_mutex);
+ UniqueRecLock lock(m_mutex);
if (!m_running || !m_connected)
return -1;
@@ -340,7 +340,7 @@
void
CcnxWrapper::clearInterestFilter (const Name &prefix)
{
- UniqueRecLock(m_mutex);
+ UniqueRecLock lock(m_mutex);
if (!m_running || !m_connected)
return;
diff --git a/src/sync-core.cc b/src/sync-core.cc
index 6856613..c325eb1 100644
--- a/src/sync-core.cc
+++ b/src/sync-core.cc
@@ -15,8 +15,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Zhenkai Zhu <zhenkai@cs.ucla.edu>
- * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-core.h"
@@ -64,7 +64,7 @@
SyncCore::yp(const Name &deviceName)
{
Name locator;
- ReadLock(m_ypMutex);
+ ReadLock lock(m_ypMutex);
if (m_yp.find(deviceName) != m_yp.end())
{
locator = m_yp[deviceName];
@@ -271,7 +271,7 @@
Name locatorName((const unsigned char *)locStr.c_str(), locStr.size());
// cout << ", Got loc: " << locatorName << endl;
m_log.UpdateLocator(deviceName, locatorName);
- WriteLock(m_ypMutex);
+ WriteLock lock(m_ypMutex);
m_yp[deviceName] = locatorName;
}
}