Mrntt: Re-add exceptionInd
This now ensures that finalizeReq is indeed called from mrntt, since exception-experiencing threads will post an exceptionInd to mrntt, which will then call finalizeReq.
This commit is contained in:
@@ -117,6 +117,34 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class MarionetteComponent::TerminationEvent
|
||||
: public PostedAsynchronousContinuation<mrnttLifetimeMgmtOpCbFn>
|
||||
{
|
||||
public:
|
||||
TerminationEvent(
|
||||
const std::shared_ptr<ComponentThread> &caller)
|
||||
: PostedAsynchronousContinuation<mrnttLifetimeMgmtOpCbFn>(
|
||||
caller, {nullptr, nullptr})
|
||||
{}
|
||||
|
||||
public:
|
||||
void exceptionInd1_posted(
|
||||
[[maybe_unused]] std::shared_ptr<TerminationEvent> context
|
||||
)
|
||||
{
|
||||
auto self = ComponentThread::getSelf();
|
||||
if (self->id != ComponentThread::MRNTT)
|
||||
{
|
||||
throw std::runtime_error(std::string(__func__)
|
||||
+ ": Must be executed on Marionette thread");
|
||||
}
|
||||
|
||||
mrntt::mrntt.finalizeReq({nullptr, std::bind(
|
||||
&mrntt::marionetteFinalizeReqCb,
|
||||
std::placeholders::_1)});
|
||||
}
|
||||
};
|
||||
|
||||
void MarionetteComponent::initializeReq(
|
||||
Callback<mrnttLifetimeMgmtOpCbFn> callback)
|
||||
{
|
||||
@@ -157,5 +185,19 @@ void MarionetteComponent::finalizeReq(
|
||||
request.get(), request)));
|
||||
}
|
||||
|
||||
void MarionetteComponent::exceptionInd()
|
||||
{
|
||||
auto faultyThread = ComponentThread::getSelf();
|
||||
auto mrntt = ComponentThread::getMrntt();
|
||||
|
||||
auto request = std::make_shared<TerminationEvent>(
|
||||
faultyThread);
|
||||
|
||||
mrntt->getIoService().post(
|
||||
STC(std::bind(
|
||||
&TerminationEvent::exceptionInd1_posted,
|
||||
request.get(), request)));
|
||||
}
|
||||
|
||||
} // namespace mrntt
|
||||
} // namespace smo
|
||||
|
||||
Reference in New Issue
Block a user