Mrntt: use keepLooping after exception; Mind: split code from mrntt

Mrntt now has the event loop structure required to orderly shut itself
down when it itself generates an exception. We can now post a message
within the catch{} blocks for Mrntt's event loop, telling Mrntt
to shut down the Mind threads and then shut itself down.

We also split the code to initialize threads etc out of mrntt and
put it into the Mind:: namespace.
This commit is contained in:
2025-07-30 09:09:38 -04:00
parent 36c79f3a2e
commit e276fcbdce
6 changed files with 79 additions and 31 deletions
+23
View File
@@ -1,2 +1,25 @@
#include <mind.h>
#include <componentThread.h>
namespace smo {
void Mind::initialize()
{
/* Start the threads */
for (auto& componentThread : smo::ComponentThread::componentThreads)
{
// Post startThread() to the event loop of all threads except MRNTT.
if (componentThread->id == ComponentThread::MRNTT) { continue; }
// JOLT the thread.
componentThread->getIoService().post([componentThread]()
{ componentThread->getIoService().stop(); }
);
// Now tell it to execute its initialization sequence.
componentThread->startThreadReq();
}
}
} // namespace smo