Body:finalize: Will run if even one initReq step was executed

If even one step in Body.initializeReq was executed at all, then
whether or not it succeeded, we consider the body component to have
been initialized, at least with respect to whether finalizeReq
ought to run.
This commit is contained in:
2025-09-15 08:30:17 -04:00
parent 29b192b2ee
commit d1e4c1a2ea
2 changed files with 17 additions and 1 deletions
+15
View File
@@ -65,6 +65,13 @@ public:
sense_api::SenseApiManager::getInstance()
.loadAllSenseApiLibsFromOptions(caller);
/** EXPLANATION:
* Consider body::initializeReq to have been called if even one of its
* operations was executed at all, whether successfully or
* unsuccessfully.
*/
context->parent.bodyComponentInitialized = true;
std::cout << sense_api::SenseApiManager::getInstance().stringifyLibs()
<< std::endl;
@@ -171,6 +178,14 @@ void Body::finalizeReq(bodyLifetimeMgmtOpCbFn callback)
+ ": Must be invoked by Mrntt thread");
}
if (!parent.bodyComponentInitialized)
{
std::cout << "Mrntt: Body component not initialized. "
<< "Skipping finalization." << "\n";
callback(true);
return;
}
auto request = std::make_shared<FinalizeReq>(
parent, mrntt, callback);
+2 -1
View File
@@ -77,7 +77,8 @@ private:
* This flag ensures that JOLTing happens exactly once and provides
* a synchronization point for the entire system initialization.
*/
bool threadsHaveBeenJolted = false;
bool threadsHaveBeenJolted = false,
bodyComponentInitialized = false;
private:
class MindLifetimeMgmtOp;