Spinscale: add dynamic coro post-to targeting; test on dev reattacher

This commit is contained in:
2026-05-30 20:46:41 -04:00
parent 35eb466a60
commit ac39a8b876
3 changed files with 14 additions and 4 deletions
+11 -2
View File
@@ -24,8 +24,16 @@ DeviceReattacher::DeviceReattacher(
mrntt::MrnttNonViralPostingInvoker DeviceReattacher::reattachKnownListCReq( mrntt::MrnttNonViralPostingInvoker DeviceReattacher::reattachKnownListCReq(
[[maybe_unused]] std::exception_ptr &exceptionPtr, [[maybe_unused]] std::exception_ptr &exceptionPtr,
[[maybe_unused]] std::function<void()> callback) [[maybe_unused]] std::function<void()> callback,
[[maybe_unused]] sscl::co::ExplicitPostTarget postTarget)
{ {
/** EXPLANATION:
* DeviceManager attach APIs require the marionette thread; postTarget
* selects where this coroutine runs (mrntt io_context). Completion still
* posts back to the mrntt timer thread via callerIoContext.
*/
(void)postTarget;
sscl::MultiOperationResultSet results = co_await sscl::MultiOperationResultSet results = co_await
parent.attachAllUnattachedDevicesFromKnownListCReq(); parent.attachAllUnattachedDevicesFromKnownListCReq();
if (results.nTotal > 0) if (results.nTotal > 0)
@@ -89,7 +97,8 @@ void DeviceReattacher::holdReattachCReq()
{ {
sscl::SpinLock::Guard guard(deviceReattacherCanceler.s.lock); sscl::SpinLock::Guard guard(deviceReattacherCanceler.s.lock);
reattachOpInFlight = false; reattachOpInFlight = false;
})); },
sscl::co::ExplicitPostTarget{ioThread->getIoContext()}));
} }
void DeviceReattacher::onTimeout(const boost::system::error_code& error) void DeviceReattacher::onTimeout(const boost::system::error_code& error)
@@ -39,7 +39,8 @@ private:
mrntt::MrnttNonViralPostingInvoker reattachKnownListCReq( mrntt::MrnttNonViralPostingInvoker reattachKnownListCReq(
std::exception_ptr &exceptionPtr, std::exception_ptr &exceptionPtr,
std::function<void()> callback); std::function<void()> callback,
sscl::co::ExplicitPostTarget postTarget);
DeviceManager &parent; DeviceManager &parent;
std::shared_ptr<sscl::ComponentThread> ioThread; std::shared_ptr<sscl::ComponentThread> ioThread;