mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Log uncaught exceptions at the top of threads (RIPD-1166)
This commit is contained in:
committed by
Nik Bougalis
parent
7295d7f4bb
commit
fdd1f2ec36
@@ -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&)>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user