From 96bf6531674a728bf552bfb209572411889f8b0c Mon Sep 17 00:00:00 2001 From: Hayodea Hakol Date: Fri, 12 Sep 2025 09:52:02 -0400 Subject: [PATCH] Add comments about Mrntt/Manager vs Mind sync/async design --- smocore/marionette/marionette.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/smocore/marionette/marionette.cpp b/smocore/marionette/marionette.cpp index 443814e..0bfa24b 100644 --- a/smocore/marionette/marionette.cpp +++ b/smocore/marionette/marionette.cpp @@ -90,7 +90,24 @@ void ComponentThread::marionetteMain(ComponentThread& self) self.getIoService().post([]() { - // Initialize Mind object (threads) first + /** EXPLANATION: + * Initialize Salmanoff's Manager classes first. + * Manager classes' initialization is synchronous in nature, so we + * don't need the minds to be running to initialize them. + * + * Then we initialize the Minds. Minds are asynchronous and they + * call upon the async methods of the Manager classes. Device + * attachment is actually Mind specific and not Smo-global + * + * It is arguable whether library loading is Mind specific or + * Smo-global. You could argue that libraries should be loaded and + * unloaded dynamically as-needed by the bodies and worlds of + * particular Minds. You could also argue that we should load all + * libraries at startup and unload them at shutdown. + * + * The latter is cleaner and more resource-respecting. The former is + * easier to implement. + */ globalMind->initializeReq( [](bool success) {