mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-02 17:06:00 +00:00
Don't use the most expensive synchronization primitives available.
This commit is contained in:
@@ -985,7 +985,7 @@ void NetworkOPs::pubProposedTransaction(Ledger::ref lpCurrent, const SerializedT
|
|||||||
Json::Value jvObj = transJson(stTxn, terResult, false, lpCurrent, "transaction");
|
Json::Value jvObj = transJson(stTxn, terResult, false, lpCurrent, "transaction");
|
||||||
|
|
||||||
{
|
{
|
||||||
boost::interprocess::sharable_lock<boost::interprocess::interprocess_upgradable_mutex> sl(mMonitorLock);
|
boost::recursive_mutex::scoped_lock sl(mMonitorLock);
|
||||||
BOOST_FOREACH(InfoSub* ispListener, mSubRTTransactions)
|
BOOST_FOREACH(InfoSub* ispListener, mSubRTTransactions)
|
||||||
{
|
{
|
||||||
ispListener->send(jvObj);
|
ispListener->send(jvObj);
|
||||||
@@ -1005,7 +1005,7 @@ void NetworkOPs::pubLedger(Ledger::ref lpAccepted)
|
|||||||
LoadEvent::pointer event = theApp->getJobQueue().getLoadEvent(jtPUBLEDGER);
|
LoadEvent::pointer event = theApp->getJobQueue().getLoadEvent(jtPUBLEDGER);
|
||||||
|
|
||||||
{
|
{
|
||||||
boost::interprocess::sharable_lock<boost::interprocess::interprocess_upgradable_mutex> sl(mMonitorLock);
|
boost::recursive_mutex::scoped_lock sl(mMonitorLock);
|
||||||
|
|
||||||
if (!mSubLedger.empty())
|
if (!mSubLedger.empty())
|
||||||
{
|
{
|
||||||
@@ -1078,7 +1078,7 @@ void NetworkOPs::pubAcceptedTransaction(Ledger::ref lpCurrent, const SerializedT
|
|||||||
Json::Value jvObj = transJson(stTxn, terResult, true, lpCurrent, "transaction");
|
Json::Value jvObj = transJson(stTxn, terResult, true, lpCurrent, "transaction");
|
||||||
|
|
||||||
{
|
{
|
||||||
boost::interprocess::sharable_lock<boost::interprocess::interprocess_upgradable_mutex> sl(mMonitorLock);
|
boost::recursive_mutex::scoped_lock sl(mMonitorLock);
|
||||||
BOOST_FOREACH(InfoSub* ispListener, mSubTransactions)
|
BOOST_FOREACH(InfoSub* ispListener, mSubTransactions)
|
||||||
{
|
{
|
||||||
ispListener->send(jvObj);
|
ispListener->send(jvObj);
|
||||||
@@ -1099,7 +1099,7 @@ void NetworkOPs::pubAccountTransaction(Ledger::ref lpCurrent, const SerializedTr
|
|||||||
boost::unordered_set<InfoSub*> notify;
|
boost::unordered_set<InfoSub*> notify;
|
||||||
|
|
||||||
{
|
{
|
||||||
boost::interprocess::sharable_lock<boost::interprocess::interprocess_upgradable_mutex> sl(mMonitorLock);
|
boost::recursive_mutex::scoped_lock sl(mMonitorLock);
|
||||||
|
|
||||||
if(!bAccepted && mSubRTAccount.empty()) return;
|
if(!bAccepted && mSubRTAccount.empty()) return;
|
||||||
|
|
||||||
@@ -1185,7 +1185,7 @@ void NetworkOPs::subAccount(InfoSub* ispListener, const boost::unordered_set<Rip
|
|||||||
subInfoMapType& subMap=mSubAccount;
|
subInfoMapType& subMap=mSubAccount;
|
||||||
if(rt) subMap=mSubRTAccount;
|
if(rt) subMap=mSubRTAccount;
|
||||||
|
|
||||||
boost::interprocess::scoped_lock<boost::interprocess::interprocess_upgradable_mutex> sl(mMonitorLock);
|
boost::recursive_mutex::scoped_lock sl(mMonitorLock);
|
||||||
|
|
||||||
BOOST_FOREACH(const RippleAddress& naAccountID, vnaAccountIDs)
|
BOOST_FOREACH(const RippleAddress& naAccountID, vnaAccountIDs)
|
||||||
{
|
{
|
||||||
@@ -1210,7 +1210,7 @@ void NetworkOPs::unsubAccount(InfoSub* ispListener, const boost::unordered_set<R
|
|||||||
{
|
{
|
||||||
subInfoMapType& subMap= rt ? mSubRTAccount : mSubAccount;
|
subInfoMapType& subMap= rt ? mSubRTAccount : mSubAccount;
|
||||||
|
|
||||||
boost::interprocess::scoped_lock<boost::interprocess::interprocess_upgradable_mutex> sl(mMonitorLock);
|
boost::recursive_mutex::scoped_lock sl(mMonitorLock);
|
||||||
|
|
||||||
BOOST_FOREACH(const RippleAddress& naAccountID, vnaAccountIDs)
|
BOOST_FOREACH(const RippleAddress& naAccountID, vnaAccountIDs)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
#ifndef __NETWORK_OPS__
|
#ifndef __NETWORK_OPS__
|
||||||
#define __NETWORK_OPS__
|
#define __NETWORK_OPS__
|
||||||
|
|
||||||
#include <boost/interprocess/sync/interprocess_upgradable_mutex.hpp>
|
#include <boost/thread/recursive_mutex.hpp>
|
||||||
#include <boost/interprocess/sync/sharable_lock.hpp>
|
|
||||||
#include <boost/unordered_map.hpp>
|
#include <boost/unordered_map.hpp>
|
||||||
#include <boost/unordered_set.hpp>
|
#include <boost/unordered_set.hpp>
|
||||||
|
|
||||||
@@ -89,7 +88,7 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
// XXX Split into more locks.
|
// XXX Split into more locks.
|
||||||
boost::interprocess::interprocess_upgradable_mutex mMonitorLock;
|
boost::recursive_mutex mMonitorLock;
|
||||||
subInfoMapType mSubAccount;
|
subInfoMapType mSubAccount;
|
||||||
subInfoMapType mSubRTAccount;
|
subInfoMapType mSubRTAccount;
|
||||||
subSubmitMapType mSubmitMap; // TODO: probably dump this
|
subSubmitMapType mSubmitMap; // TODO: probably dump this
|
||||||
|
|||||||
Reference in New Issue
Block a user