mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-26 22:15:52 +00:00
Get a lock acquire out of a critical fast path.
This commit is contained in:
@@ -168,15 +168,19 @@ void InboundLedger::onTimer (bool progress)
|
|||||||
|
|
||||||
void InboundLedger::awaitData ()
|
void InboundLedger::awaitData ()
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock sl (mLock);
|
|
||||||
++mWaitCount;
|
++mWaitCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InboundLedger::noAwaitData ()
|
void InboundLedger::noAwaitData ()
|
||||||
{
|
{ // subtract one if mWaitCount is greater than zero
|
||||||
boost::recursive_mutex::scoped_lock sl (mLock);
|
do
|
||||||
|
{
|
||||||
if (mWaitCount > 0 ) --mWaitCount;
|
int j = mWaitCount.get();
|
||||||
|
if (j <= 0)
|
||||||
|
return;
|
||||||
|
if (mWaitCount.compareAndSetBool(j - 1, j))
|
||||||
|
return;
|
||||||
|
} while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InboundLedger::addPeers ()
|
void InboundLedger::addPeers ()
|
||||||
@@ -285,7 +289,7 @@ void InboundLedger::trigger (Peer::ref peer)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mWaitCount > 0) && peer)
|
if ((mWaitCount.get() > 0) && peer)
|
||||||
{
|
{
|
||||||
WriteLog (lsTRACE, InboundLedger) << "Skipping peer";
|
WriteLog (lsTRACE, InboundLedger) << "Skipping peer";
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -102,16 +102,16 @@ private:
|
|||||||
boost::weak_ptr <PeerSet> pmDowncast ();
|
boost::weak_ptr <PeerSet> pmDowncast ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ledger::pointer mLedger;
|
Ledger::pointer mLedger;
|
||||||
bool mHaveBase;
|
bool mHaveBase;
|
||||||
bool mHaveState;
|
bool mHaveState;
|
||||||
bool mHaveTransactions;
|
bool mHaveTransactions;
|
||||||
bool mAborted;
|
bool mAborted;
|
||||||
bool mSignaled;
|
bool mSignaled;
|
||||||
bool mAccept;
|
bool mAccept;
|
||||||
bool mByHash;
|
bool mByHash;
|
||||||
int mWaitCount;
|
beast::Atomic<int> mWaitCount;
|
||||||
uint32 mSeq;
|
uint32 mSeq;
|
||||||
|
|
||||||
std::set <SHAMapNode> mRecentTXNodes;
|
std::set <SHAMapNode> mRecentTXNodes;
|
||||||
std::set <SHAMapNode> mRecentASNodes;
|
std::set <SHAMapNode> mRecentASNodes;
|
||||||
|
|||||||
Reference in New Issue
Block a user