From b4b61bb2b6d423abe31506440e9188eba2a99135 Mon Sep 17 00:00:00 2001 From: Hayodea Hekol Date: Sun, 22 Feb 2026 18:51:21 -0400 Subject: [PATCH] CompThr: Expose name arg for CompThr derivatives' ctors This enables us to statically set the thread names at compile time, or at least during construction at runtime. This completes the crux of the splitting work required to functionally split libspinscale off from SMO. --- include/spinscale/componentThread.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/include/spinscale/componentThread.h b/include/spinscale/componentThread.h index 7157c5f..44da727 100644 --- a/include/spinscale/componentThread.h +++ b/include/spinscale/componentThread.h @@ -33,16 +33,13 @@ typedef uint8_t ThreadId; class ComponentThread { protected: - ComponentThread(ThreadId _id) - : id(_id), name(getThreadName(_id)), work(io_service) + ComponentThread(ThreadId _id, std::string _name) + : id(_id), name(std::move(_name)), work(io_service) {} public: virtual ~ComponentThread() = default; - // getThreadName implementation is provided by application code - static std::string getThreadName(ThreadId id); - void cleanup(void); boost::asio::io_service& getIoService(void) { return io_service; } @@ -96,10 +93,11 @@ public: using entryPointFn = std::function; PuppeteerThread( - ThreadId id, entryPointFn entryPoint, + ThreadId id, std::string name, + entryPointFn entryPoint, pptr::PuppeteerComponent &component, preJoltHookFn preJoltFn) - : ComponentThread(id), + : ComponentThread(id, std::move(name)), entryFnArguments(*this, component, preJoltFn), thread(std::move(entryPoint), std::cref(entryFnArguments)) {} @@ -148,9 +146,10 @@ public: }; PuppetThread( - ThreadId _id, entryPointFn entryPoint, PuppetComponent &component, + ThreadId _id, std::string name, + entryPointFn entryPoint, PuppetComponent &component, preJoltHookFn preJoltFn) - : ComponentThread(_id), + : ComponentThread(_id, std::move(name)), pinnedCpuId(-1), pause_work(pause_io_service), entryFnArguments(*this, component, preJoltFn),