diff --git a/src/cpp/ripple/Ledger.cpp b/src/cpp/ripple/Ledger.cpp index 4b21ddd41..241b070c6 100644 --- a/src/cpp/ripple/Ledger.cpp +++ b/src/cpp/ripple/Ledger.cpp @@ -400,8 +400,8 @@ uint256 Ledger::getHash() return mHash; } -void Ledger::saveAcceptedLedger(bool fromConsensus, LoadEvent::pointer event) -{ // can be called in a different thread +void Ledger::saveAcceptedLedger(Job&, bool fromConsensus) +{ cLog(lsTRACE) << "saveAcceptedLedger " << (fromConsensus ? "fromConsensus " : "fromAcquire ") << getLedgerSeq(); static boost::format ledgerExists("SELECT LedgerSeq FROM Ledgers INDEXED BY SeqLedger where LedgerSeq = %d;"); static boost::format deleteLedger("DELETE FROM Ledgers WHERE LedgerSeq = %d;"); @@ -1530,8 +1530,8 @@ void Ledger::pendSave(bool fromConsensus) ++sPendingSaves; } - boost::thread(boost::bind(&Ledger::saveAcceptedLedger, shared_from_this(), fromConsensus, - theApp->getJobQueue().getLoadEvent(jtDISK, fromConsensus ? "Ledger::cSave" : "Ledger::save"))).detach(); + theApp->getJobQueue().addJob(jtPUBOLDLEDGER, // FIXME not old if fromConsensus + boost::bind(&Ledger::saveAcceptedLedger, shared_from_this(), _1, fromConsensus)); } diff --git a/src/cpp/ripple/Ledger.h b/src/cpp/ripple/Ledger.h index 34d88b8fd..847bf065f 100644 --- a/src/cpp/ripple/Ledger.h +++ b/src/cpp/ripple/Ledger.h @@ -19,6 +19,7 @@ #include "SHAMap.h" #include "InstanceCounter.h" #include "LoadMonitor.h" +#include "JobQueue.h" enum LedgerStateParms { @@ -102,7 +103,7 @@ protected: static void incPendingSaves(); static void decPendingSaves(); - void saveAcceptedLedger(bool fromConsensus, LoadEvent::pointer); + void saveAcceptedLedger(Job&, bool fromConsensus); void updateFees(); void zeroFees();