mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-23 15:20:54 +00:00
Use standard C++ types instead of type aliases:
* Remove ripple::RippleMutex and ripple::RippleRecursiveMutex and use std::mutex and std::recursive_mutex respectively. * Use std::lock_guard instead of std::unique_lock when the additional features of std::unique_lock are not needed.
This commit is contained in:
committed by
Vinnie Falco
parent
333ba69d60
commit
f424ae6942
@@ -38,7 +38,7 @@ OrderBookDB::OrderBookDB (Application& app, Stoppable& parent)
|
||||
|
||||
void OrderBookDB::invalidate ()
|
||||
{
|
||||
ScopedLockType sl (mLock);
|
||||
std::lock_guard <std::recursive_mutex> sl (mLock);
|
||||
mSeq = 0;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ void OrderBookDB::setup(
|
||||
std::shared_ptr<ReadView const> const& ledger)
|
||||
{
|
||||
{
|
||||
ScopedLockType sl (mLock);
|
||||
std::lock_guard <std::recursive_mutex> sl (mLock);
|
||||
auto seq = ledger->info().seq;
|
||||
|
||||
// Do a full update every 256 ledgers
|
||||
@@ -122,7 +122,7 @@ void OrderBookDB::update(
|
||||
{
|
||||
JLOG (j_.info)
|
||||
<< "OrderBookDB::update encountered a missing node";
|
||||
ScopedLockType sl (mLock);
|
||||
std::lock_guard <std::recursive_mutex> sl (mLock);
|
||||
mSeq = 0;
|
||||
return;
|
||||
}
|
||||
@@ -130,7 +130,7 @@ void OrderBookDB::update(
|
||||
JLOG (j_.debug)
|
||||
<< "OrderBookDB::update< " << books << " books found";
|
||||
{
|
||||
ScopedLockType sl (mLock);
|
||||
std::lock_guard <std::recursive_mutex> sl (mLock);
|
||||
|
||||
mXRPBooks.swap(XRPBooks);
|
||||
mSourceMap.swap(sourceMap);
|
||||
@@ -142,7 +142,7 @@ void OrderBookDB::update(
|
||||
void OrderBookDB::addOrderBook(Book const& book)
|
||||
{
|
||||
bool toXRP = isXRP (book.out);
|
||||
ScopedLockType sl (mLock);
|
||||
std::lock_guard <std::recursive_mutex> sl (mLock);
|
||||
|
||||
if (toXRP)
|
||||
{
|
||||
@@ -177,26 +177,26 @@ void OrderBookDB::addOrderBook(Book const& book)
|
||||
// return list of all orderbooks that want this issuerID and currencyID
|
||||
OrderBook::List OrderBookDB::getBooksByTakerPays (Issue const& issue)
|
||||
{
|
||||
ScopedLockType sl (mLock);
|
||||
std::lock_guard <std::recursive_mutex> sl (mLock);
|
||||
auto it = mSourceMap.find (issue);
|
||||
return it == mSourceMap.end () ? OrderBook::List() : it->second;
|
||||
}
|
||||
|
||||
int OrderBookDB::getBookSize(Issue const& issue) {
|
||||
ScopedLockType sl (mLock);
|
||||
std::lock_guard <std::recursive_mutex> sl (mLock);
|
||||
auto it = mSourceMap.find (issue);
|
||||
return it == mSourceMap.end () ? 0 : it->second.size();
|
||||
}
|
||||
|
||||
bool OrderBookDB::isBookToXRP(Issue const& issue)
|
||||
{
|
||||
ScopedLockType sl (mLock);
|
||||
std::lock_guard <std::recursive_mutex> sl (mLock);
|
||||
return mXRPBooks.count(issue) > 0;
|
||||
}
|
||||
|
||||
BookListeners::pointer OrderBookDB::makeBookListeners (Book const& book)
|
||||
{
|
||||
ScopedLockType sl (mLock);
|
||||
std::lock_guard <std::recursive_mutex> sl (mLock);
|
||||
auto ret = getBookListeners (book);
|
||||
|
||||
if (!ret)
|
||||
@@ -213,7 +213,7 @@ BookListeners::pointer OrderBookDB::makeBookListeners (Book const& book)
|
||||
BookListeners::pointer OrderBookDB::getBookListeners (Book const& book)
|
||||
{
|
||||
BookListeners::pointer ret;
|
||||
ScopedLockType sl (mLock);
|
||||
std::lock_guard <std::recursive_mutex> sl (mLock);
|
||||
|
||||
auto it0 = mListeners.find (book);
|
||||
if (it0 != mListeners.end ())
|
||||
@@ -228,7 +228,7 @@ void OrderBookDB::processTxn (
|
||||
std::shared_ptr<ReadView const> const& ledger,
|
||||
const AcceptedLedgerTx& alTx, Json::Value const& jvObj)
|
||||
{
|
||||
ScopedLockType sl (mLock);
|
||||
std::lock_guard <std::recursive_mutex> sl (mLock);
|
||||
|
||||
if (alTx.getResult () == tesSUCCESS)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user