From e81396216830f0c69a2fc3a11ea449783c4028fa Mon Sep 17 00:00:00 2001 From: Hayodea Hekol Date: Wed, 18 Feb 2026 01:13:02 -0400 Subject: [PATCH] Rename mrntt=>pptr We'll probably use the name "marionette" as an application-level name. --- include/spinscale/asynchronousBridge.h | 6 ++-- include/spinscale/componentThread.h | 27 ++++++++------- include/spinscale/marionette.h | 9 +++-- src/component.cpp | 5 +-- src/componentThread.cpp | 48 +++++++++++++------------- 5 files changed, 48 insertions(+), 47 deletions(-) diff --git a/include/spinscale/asynchronousBridge.h b/include/spinscale/asynchronousBridge.h index 99d050d..fe77394 100644 --- a/include/spinscale/asynchronousBridge.h +++ b/include/spinscale/asynchronousBridge.h @@ -34,9 +34,9 @@ public: { break; } /** EXPLANATION: - * In the mrntt and mind thread loops we call checkException() after - * run() returns, but we don't have to do that here because - * setException() calls stop. + * In the puppeteer and mind thread loops we call checkException() + * after run() returns, but we don't have to do that here because + * setException() calls stop(). * * So if an exception is set on our thread, we'll break out of this * loop due to the check for stopped() above, and that'll take us diff --git a/include/spinscale/componentThread.h b/include/spinscale/componentThread.h index 39d453c..930832d 100644 --- a/include/spinscale/componentThread.h +++ b/include/spinscale/componentThread.h @@ -19,7 +19,7 @@ namespace sscl { -class MarionetteThread; +class PuppeteerThread; class PuppetThread; // ThreadId is a generic type - application-specific enums should be defined elsewhere @@ -45,7 +45,7 @@ public: static const std::shared_ptr getSelf(void); static bool tlsInitialized(void); - static std::shared_ptr getMrntt(); + static std::shared_ptr getMrntt(); typedef void (mainFn)(ComponentThread &self); @@ -66,18 +66,18 @@ public: std::atomic keepLooping; }; -class MarionetteThread -: public std::enable_shared_from_this, +class PuppeteerThread +: public std::enable_shared_from_this, public ComponentThread { public: - MarionetteThread(ThreadId id = 0) + PuppeteerThread(ThreadId id = 0) : ComponentThread(id), thread(main, std::ref(*this)) { } - static void main(MarionetteThread& self); + static void main(PuppeteerThread& self); void initializeTls(void); public: @@ -154,14 +154,15 @@ public: class ThreadLifetimeMgmtOp; }; -namespace mrntt { -extern std::shared_ptr thread; +namespace pptr { +extern std::shared_ptr thread; -// Forward declaration for marionette thread ID management +// Forward declaration for puppeteer thread ID management // Must be after sscl namespace so ThreadId is defined -extern ThreadId marionetteThreadId; -void setMarionetteThreadId(ThreadId id); -} // namespace mrntt -} +extern ThreadId puppeteerThreadId; +void setPuppeteerThreadId(ThreadId id); +} // namespace pptr + +} // namespace sscl #endif // COMPONENT_THREAD_H diff --git a/include/spinscale/marionette.h b/include/spinscale/marionette.h index ad55918..05759dd 100644 --- a/include/spinscale/marionette.h +++ b/include/spinscale/marionette.h @@ -8,9 +8,10 @@ namespace sscl { -class MarionetteThread; +class PuppeteerThread; +extern std::shared_ptr thread; -namespace mrntt { +namespace pptr { class MarionetteComponent : public sscl::Component @@ -31,14 +32,12 @@ private: class TerminationEvent; }; -extern std::shared_ptr thread; - extern std::atomic exitCode; void exitMarionetteLoop(); void marionetteFinalizeReqCb(bool success); extern MarionetteComponent mrntt; -} // namespace mrntt +} // namespace pptr struct CrtCommandLineArgs { diff --git a/src/component.cpp b/src/component.cpp index 988c095..898578e 100644 --- a/src/component.cpp +++ b/src/component.cpp @@ -16,7 +16,7 @@ parent(parent) { } -namespace mrntt { +namespace pptr { MarionetteComponent::MarionetteComponent( const std::shared_ptr &thread) @@ -24,5 +24,6 @@ MarionetteComponent::MarionetteComponent( { } -} // namespace mrntt +} // namespace pptr + } // namespace sscl diff --git a/src/componentThread.cpp b/src/componentThread.cpp index 591c967..85be3af 100644 --- a/src/componentThread.cpp +++ b/src/componentThread.cpp @@ -13,33 +13,33 @@ namespace sscl { -namespace mrntt { -/* Global variable to store the marionette thread ID +namespace pptr { +/* Global variable to store the puppeteer thread ID * Default value is 0, but should be set by application code via - * setMarionetteThreadId(). + * setPuppeteerThreadId(). */ -ThreadId marionetteThreadId = 0; -/* Global marionette thread instance - defined here but initialized by +ThreadId puppeteerThreadId = 0; +/* Global puppeteer thread instance - defined here but initialized by * application code. */ -std::shared_ptr thread; +std::shared_ptr thread; -void setMarionetteThreadId(ThreadId id) +void setPuppeteerThreadId(ThreadId id) { - marionetteThreadId = id; + puppeteerThreadId = id; } -} // namespace mrntt +} // namespace pptr thread_local std::shared_ptr thisComponentThread; // Implementation of static method -std::shared_ptr ComponentThread::getMrntt() +std::shared_ptr ComponentThread::getMrntt() { - return sscl::mrntt::thread; + return sscl::pptr::thread; } -void MarionetteThread::initializeTls(void) +void PuppeteerThread::initializeTls(void) { thisComponentThread = shared_from_this(); } @@ -177,24 +177,24 @@ void PuppetThread::joltThreadReq( * We also can't use getSelf() as yet for the same reason: getSelf() * requires TLS to be set up. * - * To obtain a sh_ptr to the caller, we just supply the mrntt thread since - * JOLT is always invoked by the mrntt thread. The JOLT sequence that the - * CRT main() function invokes on the mrntt thread is special since it - * supplies cmdline args and envp. + * To obtain a sh_ptr to the caller, we just supply the puppeteer thread + * since JOLT is always invoked by the puppeteer thread. The JOLT sequence + * that the CRT main() function invokes on the puppeteer thread is special + * since it supplies cmdline args and envp. * * To obtain a sh_ptr to the target thread, we use the selfPtr parameter * passed in by the caller. */ - if (id == sscl::mrntt::marionetteThreadId) + if (id == sscl::pptr::puppeteerThreadId) { throw std::runtime_error(std::string(__func__) - + ": invoked on mrntt thread"); + + ": invoked on puppeteer thread"); } - std::shared_ptr mrntt = sscl::mrntt::thread; + std::shared_ptr puppeteer = sscl::pptr::thread; auto request = std::make_shared( - mrntt, selfPtr, callback); + puppeteer, selfPtr, callback); this->getIoService().post( STC(std::bind( @@ -236,10 +236,10 @@ void PuppetThread::exitThreadReq(Callback callback) void PuppetThread::pauseThreadReq(Callback callback) { - if (id == sscl::mrntt::marionetteThreadId) + if (id == sscl::pptr::puppeteerThreadId) { throw std::runtime_error(std::string(__func__) - + ": invoked on mrntt thread"); + + ": invoked on puppeteer thread"); } std::shared_ptr caller = getSelf(); @@ -255,10 +255,10 @@ void PuppetThread::pauseThreadReq(Callback callback) void PuppetThread::resumeThreadReq(Callback callback) { - if (id == sscl::mrntt::marionetteThreadId) + if (id == sscl::pptr::puppeteerThreadId) { throw std::runtime_error(std::string(__func__) - + ": invoked on mrntt thread"); + + ": invoked on puppeteer thread"); } // Post to the pause_io_service to unblock the paused thread