Mind,Mrntt: Use async pattern in Mind; init threads before initializeSmo
In Mrntt, we now initialize Mind:: object threads before calling initializeSalmanoffReq(). We've also propagated the spinscale async pattern into the Mind class.
This commit is contained in:
@@ -90,16 +90,24 @@ void ComponentThread::marionetteMain(ComponentThread& self)
|
||||
|
||||
self.getIoService().post([]()
|
||||
{
|
||||
// Initialize Salmanoff first
|
||||
initializeSalmanoff([](bool success)
|
||||
{
|
||||
if (success) {
|
||||
// Then initialize the global Mind object
|
||||
globalMind->initialize();
|
||||
} else {
|
||||
std::cerr << "Failed to initialize Salmanoff" << std::endl;
|
||||
// Initialize Mind object (threads) first
|
||||
globalMind->initializeReq(
|
||||
[](bool success)
|
||||
{
|
||||
if (success) {
|
||||
initializeSalmanoff([](bool success) {
|
||||
if (!success) {
|
||||
std::cerr << "Failed to initialize "
|
||||
"Salmanoff" << '\n';
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
std::cerr << "Failed to initialize Mind object "
|
||||
"(threads)" << '\n';
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
});
|
||||
|
||||
std::cout << __func__ << ": Entering event loop" << "\n";
|
||||
@@ -199,7 +207,10 @@ void ComponentThread::marionetteMain(ComponentThread& self)
|
||||
|
||||
if (callFinalizeReq)
|
||||
{
|
||||
globalMind->finalizeReq([]{
|
||||
globalMind->finalizeReq([](bool success) {
|
||||
if (!success) {
|
||||
std::cerr << "Failed to finalize Mind object (threads)" << '\n';
|
||||
}
|
||||
mrntt::mrntt->getIoService().stop();
|
||||
});
|
||||
self.getIoService().reset();
|
||||
|
||||
Reference in New Issue
Block a user