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:
2025-09-11 20:11:10 -04:00
parent 89947dfc71
commit 4429135539
3 changed files with 266 additions and 143 deletions
+21 -10
View File
@@ -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();