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:
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user