Use the job queue rather than an ephemeral thread for validation writeouts.

This commit is contained in:
JoelKatz
2013-02-27 15:52:33 -08:00
parent 50be7dd7e4
commit ab89fbdcf6
2 changed files with 4 additions and 4 deletions

View File

@@ -293,11 +293,10 @@ void ValidationCollection::condWrite()
if (mWriting)
return;
mWriting = true;
boost::thread thread(boost::bind(&ValidationCollection::doWrite, this));
thread.detach();
theApp->getJobQueue().addJob(jtWRITE, boost::bind(&ValidationCollection::doWrite, this, _1));
}
void ValidationCollection::doWrite()
void ValidationCollection::doWrite(Job&)
{
LoadEvent::autoptr event(theApp->getJobQueue().getLoadEventAP(jtDISK));
static boost::format insVal("INSERT INTO Validations "

View File

@@ -10,6 +10,7 @@
#include "types.h"
#include "SerializedValidation.h"
#include "TaggedCache.h"
#include "JobQueue.h"
typedef boost::unordered_map<uint160, SerializedValidation::pointer> ValidationSet;
@@ -26,7 +27,7 @@ protected:
bool mWriting;
void doWrite();
void doWrite(Job&);
void condWrite();
boost::shared_ptr<ValidationSet> findCreateSet(const uint256& ledgerHash);