From 3f91cbf104397c27d0431986d183610e71ccaf9c Mon Sep 17 00:00:00 2001 From: Hayodea Hekol Date: Tue, 19 May 2026 10:01:15 -0400 Subject: [PATCH] CompThr: make new changes compile --- include/spinscale/componentThread.h | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/include/spinscale/componentThread.h b/include/spinscale/componentThread.h index e3b38c8..5207c82 100644 --- a/include/spinscale/componentThread.h +++ b/include/spinscale/componentThread.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -160,20 +161,25 @@ public: void initializeTls(void); + typedef std::function threadLifetimeMgmtOpCbFn; + struct ViralThreadLifetimeMgmtInvoker { ViralThreadLifetimeMgmtInvoker( - ThreadOp _threadOp + ThreadOp _threadOp, PuppetThread &_parentThread, const std::shared_ptr &_selfPtr = nullptr) : threadOp(_threadOp), parentThread(_parentThread), selfPtr(_selfPtr) { - cps::Callback callback = [this] - { - settled = true; - if (callerSchedHandle) - { callerSchedHandle.resume(); } - }; + cps::Callback callback{ + nullptr, + [this]() + { + settled = true; + if (callerSchedHandle) { + callerSchedHandle.resume(); + } + }}; if (threadOp == ThreadOp::JOLT && selfPtr == nullptr) { @@ -208,7 +214,7 @@ public: bool await_ready() const noexcept { return settled; } bool await_suspend( - std::coroutine_handle const _callerSchedHandle) noexcept + std::coroutine_handle<> _callerSchedHandle) noexcept { if (settled) { return false; } callerSchedHandle = _callerSchedHandle; @@ -217,8 +223,9 @@ public: void await_resume() noexcept {} + ThreadOp threadOp; bool settled = false; - std::coroutine_handle callerSchedHandle; + std::coroutine_handle<> callerSchedHandle; PuppetThread &parentThread; const std::shared_ptr selfPtr; }; @@ -232,8 +239,6 @@ public: ViralThreadLifetimeMgmtInvoker exitThreadAReq() { return ViralThreadLifetimeMgmtInvoker(ThreadOp::EXIT, *this); } - // Thread management methods - typedef std::function threadLifetimeMgmtOpCbFn; void startThreadReq(cps::Callback callback); void exitThreadReq(cps::Callback callback); void pauseThreadReq(cps::Callback callback);