From 9159e9f7b44d65c343aa3d7b22157a1cb7433fd3 Mon Sep 17 00:00:00 2001 From: Hayodea Hekol Date: Wed, 18 Feb 2026 01:14:26 -0400 Subject: [PATCH] Update: rename mrntt=>pptr --- libspinscale | 2 +- main.cpp | 14 +++++----- smocore/deviceManager/deviceManager.cpp | 16 +++++------ smocore/marionette/lifetime.cpp | 14 +++++----- smocore/marionette/main.cpp | 35 ++++++++++++------------- smocore/mind.cpp | 4 +-- smocore/mindThread.cpp | 2 +- 7 files changed, 43 insertions(+), 44 deletions(-) diff --git a/libspinscale b/libspinscale index e77ecd4..e813962 160000 --- a/libspinscale +++ b/libspinscale @@ -1 +1 @@ -Subproject commit e77ecd447d798eb1d1d0069a6f4f09552ff5aa74 +Subproject commit e81396216830f0c69a2fc3a11ea449783c4028fa diff --git a/main.cpp b/main.cpp index 684976f..1bbe385 100644 --- a/main.cpp +++ b/main.cpp @@ -6,26 +6,26 @@ int main(int argc, char *argv[], char *envp[]) { - // Set the marionette thread ID before using any ComponentThread functionality - sscl::mrntt::setMarionetteThreadId(smo::SmoThreadId::MRNTT); + // Set the pptr thread ID before using any ComponentThread functionality + sscl::pptr::setPuppeteerThreadId(smo::SmoThreadId::MRNTT); pthread_setname_np(pthread_self(), "smo:CRT:main"); /* We don't do anything inside of main() * Main merely waits for the marionette thread to exit. */ std::cout << "CRT:" << __func__ << ": about to JOLT Mrntt with cmdline args" << '\n'; - sscl::mrntt::thread->getIoService().post( + sscl::pptr::thread->getIoService().post( [argc, argv, envp]() { std::cout << "Mrntt:" << __func__ << ":JOLTED: setting cmdline args" << '\n'; sscl::CrtCommandLineArgs::set(argc, argv, envp); - sscl::mrntt::thread->getIoService().stop(); + sscl::pptr::thread->getIoService().stop(); } ); - sscl::mrntt::thread->thread.join(); + sscl::pptr::thread->thread.join(); std::cout << "CRT:" << __func__ << ": Mrntt exited with code '" - << sscl::mrntt::exitCode << "'\n"; - return sscl::mrntt::exitCode; + << sscl::pptr::exitCode << "'\n"; + return sscl::pptr::exitCode; } diff --git a/smocore/deviceManager/deviceManager.cpp b/smocore/deviceManager/deviceManager.cpp index 5eb1450..098e73e 100644 --- a/smocore/deviceManager/deviceManager.cpp +++ b/smocore/deviceManager/deviceManager.cpp @@ -304,7 +304,7 @@ void DeviceManager::newDeviceAttachmentSpecInd( }); NewDeviceAttachmentSpecInd::LockerAndInvoker lockvoker( - *request, sscl::mrntt::mrntt.thread, + *request, sscl::pptr::mrntt.thread, std::bind( &NewDeviceAttachmentSpecInd::newDeviceAttachmentSpecInd1_posted, request.get(), request)); @@ -323,7 +323,7 @@ void DeviceManager::removeDeviceAttachmentSpecReq( }); RemoveDeviceAttachmentSpecReq::LockerAndInvoker lockvoker( - *request, sscl::mrntt::mrntt.thread, + *request, sscl::pptr::mrntt.thread, std::bind( &RemoveDeviceAttachmentSpecReq ::removeDeviceAttachmentSpecReq1_posted, @@ -500,7 +500,7 @@ void DeviceManager::attachStimBuffDeviceReq( }); AttachStimBuffDeviceReq::LockerAndInvoker lockvoker( - *request, sscl::mrntt::mrntt.thread, + *request, sscl::pptr::mrntt.thread, std::bind( &AttachStimBuffDeviceReq::attachStimBuffDeviceReq1_posted, request.get(), request)); @@ -535,7 +535,7 @@ void DeviceManager::detachStimBuffDeviceReq( }); DetachStimBuffDeviceReq::LockerAndInvoker lockvoker( - *request, sscl::mrntt::mrntt.thread, + *request, sscl::pptr::mrntt.thread, std::bind( &DetachStimBuffDeviceReq::detachStimBuffDeviceReq1_posted, request.get(), request)); @@ -626,7 +626,7 @@ void DeviceManager::attachAllUnattachedDevicesFromReq( auto request = std::make_shared( specs->size(), specs, caller, std::move(cb)); - sscl::mrntt::mrntt.thread->getIoService().post( + sscl::pptr::mrntt.thread->getIoService().post( STC(std::bind( &AttachAllUnattachedDevicesFromReq ::attachAllUnattachedDevicesFromReq1_posted, @@ -723,7 +723,7 @@ void DeviceManager::attachAllUnattachedDevicesFromKnownListReq( }); AttachAllUnattachedDevicesFromKnownListReq::LockerAndInvoker lockvoker( - *request, sscl::mrntt::mrntt.thread, + *request, sscl::pptr::mrntt.thread, std::bind( &AttachAllUnattachedDevicesFromKnownListReq ::attachAllUnattachedDevicesFromKnownListReq1_posted, @@ -807,7 +807,7 @@ void DeviceManager::detachAllAttachedDeviceRoles( DeviceManager::getInstance().attachedDeviceRoles.size(), caller, std::move(cb)); - sscl::mrntt::mrntt.thread->getIoService().post( + sscl::pptr::mrntt.thread->getIoService().post( STC(std::bind( &DetachAllAttachedDeviceRoles::detachAllAttachedDeviceRoles1_posted, request.get(), request))); @@ -816,7 +816,7 @@ void DeviceManager::detachAllAttachedDeviceRoles( void DeviceManager::initializeDeviceReattacher() { deviceReattacher = std::make_unique( - *this, sscl::mrntt::mrntt.thread); + *this, sscl::pptr::mrntt.thread); deviceReattacher->start(); } diff --git a/smocore/marionette/lifetime.cpp b/smocore/marionette/lifetime.cpp index c7c98e1..6aa2650 100644 --- a/smocore/marionette/lifetime.cpp +++ b/smocore/marionette/lifetime.cpp @@ -10,7 +10,7 @@ #include namespace sscl { -namespace mrntt { +namespace pptr { class MarionetteComponent::MrnttLifetimeMgmtOp : public sscl::PostedAsynchronousContinuation @@ -139,13 +139,13 @@ public: + ": Must be executed on Marionette thread"); } - sscl::mrntt::mrntt.finalizeReq({nullptr, std::bind( - &sscl::mrntt::marionetteFinalizeReqCb, + sscl::pptr::mrntt.finalizeReq({nullptr, std::bind( + &sscl::pptr::marionetteFinalizeReqCb, std::placeholders::_1)}); } }; -void sscl::mrntt::MarionetteComponent::initializeReq( +void sscl::pptr::MarionetteComponent::initializeReq( sscl::Callback callback) { auto mrntt = sscl::ComponentThread::getSelf(); @@ -165,7 +165,7 @@ void sscl::mrntt::MarionetteComponent::initializeReq( request.get(), request))); } -void sscl::mrntt::MarionetteComponent::finalizeReq( +void sscl::pptr::MarionetteComponent::finalizeReq( sscl::Callback callback) { auto mrntt = sscl::ComponentThread::getSelf(); @@ -185,7 +185,7 @@ void sscl::mrntt::MarionetteComponent::finalizeReq( request.get(), request))); } -void sscl::mrntt::MarionetteComponent::exceptionInd() +void sscl::pptr::MarionetteComponent::exceptionInd() { auto faultyThread = sscl::ComponentThread::getSelf(); auto mrntt = sscl::ComponentThread::getMrntt(); @@ -199,5 +199,5 @@ void sscl::mrntt::MarionetteComponent::exceptionInd() request.get(), request))); } -} // namespace mrntt +} // namespace pptr } // namespace sscl diff --git a/smocore/marionette/main.cpp b/smocore/marionette/main.cpp index c2f8b56..f21e870 100644 --- a/smocore/marionette/main.cpp +++ b/smocore/marionette/main.cpp @@ -14,13 +14,11 @@ #include #include -// Define the global marionette thread instance (declared extern in libspinscale) +// Define the global puppeteer thread instance (declared extern in libspinscale) namespace sscl { -namespace mrntt { -std::shared_ptr thread = std::make_shared(); -} // namespace mrntt +namespace pptr { -namespace mrntt { +std::shared_ptr thread = std::make_shared(); std::atomic exitCode; MarionetteComponent mrntt(std::static_pointer_cast(thread)); @@ -41,7 +39,8 @@ void marionetteFinalizeReqCb(bool success) std::cout << __func__ << ": Marionette finalized." << '\n'; exitMarionetteLoop(); } -} // namespace mrntt + +} // namespace pptr } // namespace sscl namespace smo { @@ -57,8 +56,8 @@ void marionetteInitializeReqCb(bool success) std::cerr << __func__ << ": Failed to initialize Marionette. Shutting down." << '\n'; - sscl::mrntt::mrntt.finalizeReq({nullptr, std::bind( - &sscl::mrntt::marionetteFinalizeReqCb, + sscl::pptr::mrntt.finalizeReq({nullptr, std::bind( + &sscl::pptr::marionetteFinalizeReqCb, std::placeholders::_1)}); } @@ -66,7 +65,7 @@ void marionetteInitializeReqCb(bool success) namespace sscl { -void MarionetteThread::main(MarionetteThread& self) +void PuppeteerThread::main(PuppeteerThread& self) { std::string threadName = "smo:" + self.name; pthread_setname_np(pthread_self(), threadName.c_str()); @@ -74,7 +73,7 @@ void MarionetteThread::main(MarionetteThread& self) std::cout << __func__ << ": Waiting for command line JOLT" << std::endl; self.getIoService().run(); self.initializeTls(); - sscl::mrntt::exitCode = EXIT_SUCCESS; + sscl::pptr::exitCode = EXIT_SUCCESS; static boost::asio::signal_set signals(self.getIoService(), SIGINT); bool callShutdownSalmanoff = false; @@ -96,8 +95,8 @@ void MarionetteThread::main(MarionetteThread& self) default: break; } - sscl::mrntt::mrntt.finalizeReq({nullptr, std::bind( - &sscl::mrntt::marionetteFinalizeReqCb, + sscl::pptr::mrntt.finalizeReq({nullptr, std::bind( + &sscl::pptr::marionetteFinalizeReqCb, std::placeholders::_1)}); } ); @@ -140,7 +139,7 @@ void MarionetteThread::main(MarionetteThread& self) callShutdownSalmanoff = true; // Create new Mind instance just before initializeReq - sscl::mrntt::mrntt.initializeReq({nullptr, std::bind( + sscl::pptr::mrntt.initializeReq({nullptr, std::bind( &smo::marionetteInitializeReqCb, std::placeholders::_1)}); std::cout << __func__ << ": Entering event loop" << "\n"; @@ -184,8 +183,8 @@ void MarionetteThread::main(MarionetteThread& self) if (sendExceptionInd) { - sscl::mrntt::exitCode = EXIT_FAILURE; - sscl::mrntt::mrntt.exceptionInd(); + sscl::pptr::exitCode = EXIT_FAILURE; + sscl::pptr::mrntt.exceptionInd(); } } @@ -198,7 +197,7 @@ void MarionetteThread::main(MarionetteThread& self) if (typeid(e) == typeid(OptionsParserError)) { - sscl::mrntt::exitCode = EXIT_FAILURE; + sscl::pptr::exitCode = EXIT_FAILURE; out = &std::cerr; outUsageMsg = std::string(__func__) + ": "; } @@ -209,12 +208,12 @@ void MarionetteThread::main(MarionetteThread& self) { std::cerr << __func__ << ": Exception occurred: " << e.what() << std::endl; - sscl::mrntt::exitCode = EXIT_FAILURE; + sscl::pptr::exitCode = EXIT_FAILURE; } catch (...) { std::cerr << __func__ << ": Unknown exception occurred" << std::endl; - sscl::mrntt::exitCode = EXIT_FAILURE; + sscl::pptr::exitCode = EXIT_FAILURE; } if (callShutdownSalmanoff) { diff --git a/smocore/mind.cpp b/smocore/mind.cpp index ad2c979..b86ba2a 100644 --- a/smocore/mind.cpp +++ b/smocore/mind.cpp @@ -227,7 +227,7 @@ void Mind::initializeReq(sscl::Callback callback) auto request = std::make_shared( *this, caller, callback); - sscl::mrntt::mrntt.thread->getIoService().post( + sscl::pptr::mrntt.thread->getIoService().post( STC(std::bind( &MindLifetimeMgmtOp::initializeReq1_posted, request.get(), request))); @@ -239,7 +239,7 @@ void Mind::finalizeReq(sscl::Callback callback) auto request = std::make_shared( *this, caller, callback); - sscl::mrntt::mrntt.thread->getIoService().post( + sscl::pptr::mrntt.thread->getIoService().post( STC(std::bind( &MindLifetimeMgmtOp::finalizeReq1_posted, request.get(), request))); diff --git a/smocore/mindThread.cpp b/smocore/mindThread.cpp index 1bb4b2f..11e8f92 100644 --- a/smocore/mindThread.cpp +++ b/smocore/mindThread.cpp @@ -6,7 +6,7 @@ namespace smo { void MindThread::handleException() { - sscl::mrntt::mrntt.exceptionInd(); + sscl::pptr::mrntt.exceptionInd(); } } // namespace smo