Add Mrntt component; init globalMind in mrntt.initializeReq
This makes the initialization sequence much cleaner and conceptually well encapsulated. We also now dynamically allocate the Mind objects. They're allocated dynamically by Mrntt inside of initializeReq. This means that we no longer have to worry about jolting and cleaning up the running threads of global mind object even when we never explicitly called Mind.initializeReq. Along with other conceptual improvements to our abstractions, this patch also gets us to a real "end of program initialization" point for the first time.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <opts.h>
|
||||
#include <asynchronousContinuation.h>
|
||||
#include <mind.h>
|
||||
#include <mindManager/mindManager.h>
|
||||
#include <componentThread.h>
|
||||
#include <marionette/marionette.h>
|
||||
|
||||
@@ -16,7 +17,7 @@ thread_local std::shared_ptr<ComponentThread> thisComponentThread;
|
||||
// Implementation of static method
|
||||
std::shared_ptr<MarionetteThread> ComponentThread::getMrntt()
|
||||
{
|
||||
return mrntt::mrntt;
|
||||
return mrntt::thread;
|
||||
}
|
||||
|
||||
void MarionetteThread::initializeTls(void)
|
||||
@@ -93,7 +94,7 @@ void MindThread::main(MindThread& self)
|
||||
}
|
||||
|
||||
if (sendExceptionInd)
|
||||
{ mrntt::mrntt->exceptionInd(self.shared_from_this()); }
|
||||
{ mrntt::thread->exceptionInd(self.shared_from_this()); }
|
||||
}
|
||||
|
||||
std::cout << self.name << ":" << __func__ << ": Exited event loop" << "\n";
|
||||
@@ -228,7 +229,7 @@ void MindThread::joltThreadReq(threadLifetimeMgmtOpCbFn callback)
|
||||
+ ": invoked on mrntt thread");
|
||||
}
|
||||
|
||||
std::shared_ptr<MarionetteThread> mrntt = mrntt::mrntt;
|
||||
std::shared_ptr<MarionetteThread> mrntt = mrntt::thread;
|
||||
std::shared_ptr<MindThread> target = getParent().getComponentThread(id);
|
||||
|
||||
auto request = std::make_shared<ThreadLifetimeMgmtOp>(
|
||||
@@ -330,7 +331,7 @@ public:
|
||||
* An exception has occurred in one of a mind's threads. We need to
|
||||
* shut down all of that particular mind's threads.
|
||||
*/
|
||||
globalMind->finalizeReq(
|
||||
smo::mind::globalMind->finalizeReq(
|
||||
std::bind(
|
||||
&MindShutdownIndOp::mindShutdownInd2,
|
||||
context.get(), context));
|
||||
@@ -351,7 +352,7 @@ public:
|
||||
* So this should ideally be a loop
|
||||
* through all running Minds, calling finalizeReq on each one.
|
||||
*/
|
||||
globalMind->finalizeReq(
|
||||
smo::mind::globalMind->finalizeReq(
|
||||
std::bind(
|
||||
&MindShutdownIndOp::mindShutdownInd2,
|
||||
context.get(), context));
|
||||
|
||||
Reference in New Issue
Block a user