Log uncaught exceptions at the top of threads (RIPD-1166)

This commit is contained in:
Scott Schurr
2016-05-25 19:13:34 -07:00
committed by Nik Bougalis
parent 7295d7f4bb
commit fdd1f2ec36
21 changed files with 452 additions and 21 deletions

View File

@@ -19,6 +19,7 @@
#include <BeastConfig.h>
#include <ripple/core/Job.h>
#include <ripple/core/ReportUncaughtException.h>
#include <cassert>
namespace ripple {
@@ -76,14 +77,15 @@ bool Job::shouldCancel () const
void Job::doJob ()
{
m_loadEvent->start ();
m_loadEvent->reName (mName);
mJob (*this);
// Destroy the lambda, otherwise we won't include
// its duration in the time measurement
mJob = std::function<void(Job&)>();
reportUncaughtException (this, &Job::doJobImpl, "Job::doJob()",
[this] ()
{
std::stringstream ss;
ss << "Job name: " << this->mName
<< "; Job type: " << this->mType
<< "; Job info: " << this->mJob.target_type().name();
return ss.str();
});
}
void Job::rename (std::string const& newName)
@@ -135,4 +137,16 @@ bool Job::operator<= (const Job& j) const
return mJobIndex <= j.mJobIndex;
}
void Job::doJobImpl ()
{
m_loadEvent->start ();
m_loadEvent->reName (mName);
mJob (*this);
// Destroy the lambda, otherwise we won't include
// its duration in the time measurement
mJob = std::function<void(Job&)>();
}
}