Use RippleMutex instead of boost::mutex

This commit is contained in:
Vinnie Falco
2013-08-22 21:31:22 -07:00
parent c21a53a3ea
commit f14333012b
79 changed files with 798 additions and 721 deletions

View File

@@ -68,7 +68,8 @@ private:
public:
explicit HashRouter (int holdTime)
: mHoldTime (holdTime)
: mLock (this, "HashRouter", __FILE__, __LINE__)
, mHoldTime (holdTime)
{
}
@@ -87,7 +88,9 @@ private:
Entry& findCreateEntry (uint256 const& , bool& created);
boost::mutex mSuppressionMutex;
typedef RippleMutex LockType;
typedef LockType::ScopedLockType ScopedLockType;
LockType mLock;
// Stores all suppressed hashes and their expiration time
boost::unordered_map <uint256, Entry> mSuppressionMap;
@@ -131,7 +134,7 @@ HashRouter::Entry& HashRouter::findCreateEntry (uint256 const& index, bool& crea
bool HashRouter::addSuppression (uint256 const& index)
{
boost::mutex::scoped_lock sl (mSuppressionMutex);
ScopedLockType sl (mLock, __FILE__, __LINE__);
bool created;
findCreateEntry (index, created);
@@ -140,7 +143,7 @@ bool HashRouter::addSuppression (uint256 const& index)
HashRouter::Entry HashRouter::getEntry (uint256 const& index)
{
boost::mutex::scoped_lock sl (mSuppressionMutex);
ScopedLockType sl (mLock, __FILE__, __LINE__);
bool created;
return findCreateEntry (index, created);
@@ -148,7 +151,7 @@ HashRouter::Entry HashRouter::getEntry (uint256 const& index)
bool HashRouter::addSuppressionPeer (uint256 const& index, uint64 peer)
{
boost::mutex::scoped_lock sl (mSuppressionMutex);
ScopedLockType sl (mLock, __FILE__, __LINE__);
bool created;
findCreateEntry (index, created).addPeer (peer);
@@ -157,7 +160,7 @@ bool HashRouter::addSuppressionPeer (uint256 const& index, uint64 peer)
bool HashRouter::addSuppressionPeer (uint256 const& index, uint64 peer, int& flags)
{
boost::mutex::scoped_lock sl (mSuppressionMutex);
ScopedLockType sl (mLock, __FILE__, __LINE__);
bool created;
Entry& s = findCreateEntry (index, created);
@@ -168,7 +171,7 @@ bool HashRouter::addSuppressionPeer (uint256 const& index, uint64 peer, int& fla
int HashRouter::getFlags (uint256 const& index)
{
boost::mutex::scoped_lock sl (mSuppressionMutex);
ScopedLockType sl (mLock, __FILE__, __LINE__);
bool created;
return findCreateEntry (index, created).getFlags ();
@@ -176,7 +179,7 @@ int HashRouter::getFlags (uint256 const& index)
bool HashRouter::addSuppressionFlags (uint256 const& index, int flag)
{
boost::mutex::scoped_lock sl (mSuppressionMutex);
ScopedLockType sl (mLock, __FILE__, __LINE__);
bool created;
findCreateEntry (index, created).setFlag (flag);
@@ -192,7 +195,7 @@ bool HashRouter::setFlag (uint256 const& index, int flag)
// return: true = changed, false = unchanged
assert (flag != 0);
boost::mutex::scoped_lock sl (mSuppressionMutex);
ScopedLockType sl (mLock, __FILE__, __LINE__);
bool created;
Entry& s = findCreateEntry (index, created);
@@ -206,7 +209,7 @@ bool HashRouter::setFlag (uint256 const& index, int flag)
bool HashRouter::swapSet (uint256 const& index, std::set<uint64>& peers, int flag)
{
boost::mutex::scoped_lock sl (mSuppressionMutex);
ScopedLockType sl (mLock, __FILE__, __LINE__);
bool created;
Entry& s = findCreateEntry (index, created);