Nursery: Initial integration

StimulusProducer: syncAwaitAllSettlements should pump caller io_context
This commit is contained in:
2026-06-09 11:19:42 -04:00
parent 5b81ea893c
commit 91fc655b25
15 changed files with 326 additions and 383 deletions
@@ -1,14 +1,12 @@
#ifndef DEVICEREATTACHER_H
#define DEVICEREATTACHER_H
#include <atomic>
#include <chrono>
#include <exception>
#include <functional>
#include <memory>
#include <optional>
#include <boost/asio/deadline_timer.hpp>
#include <marionette/marionetteThread.h>
#include <spinscale/co/dynamicPostingInvoker.h>
#include <spinscale/co/nonViralTaskNursery.h>
#include <spinscale/co/postTarget.h>
#include <spinscale/syncCancelerForAsyncWork.h>
namespace smo {
@@ -32,23 +30,17 @@ public:
void stop();
private:
void scheduleNextTimeout();
void onTimeout(const boost::system::error_code& error);
void holdReattachCReq();
mrntt::MrnttNonViralNonPostingInvoker reattachKnownListCReq(
sscl::co::DynamicNonViralPostingInvoker deviceReattacherCDaemon(
sscl::co::ExplicitPostTarget postTarget,
std::exception_ptr &exceptionPtr,
std::function<void()> callback);
std::function<void()> callback,
sscl::SyncCancelerForAsyncWork &canceler);
DeviceManager &parent;
// io_context thread for timer and non-posting reattach shell (see ctor).
// io_context thread for timer (see ctor).
std::shared_ptr<sscl::ComponentThread> ioThread;
sscl::SyncCancelerForAsyncWork deviceReattacherCanceler;
boost::asio::deadline_timer timer;
std::exception_ptr reattachLifetimeExceptionPtr;
std::optional<mrntt::MrnttNonViralNonPostingInvoker> reattachCReqInvoker;
bool reattachOpInFlight = false;
std::chrono::steady_clock::time_point lastReattachReqTimestamp{};
sscl::co::NonViralTaskNursery taskNursery;
boost::asio::deadline_timer daemonTimer;
};
} // namespace device
+6 -8
View File
@@ -9,6 +9,7 @@
#include <memory>
#include <optional>
#include <spinscale/component.h>
#include <spinscale/co/nonViralTaskNursery.h>
#include <marionette/marionetteThread.h>
namespace sscl {
@@ -29,8 +30,10 @@ public:
{}
~MarionetteComponent() = default;
void holdInitializeCReq(std::function<void()> completion);
void holdFinalizeCReq(std::function<void()> completion);
void holdInitializeCReq(
std::function<void(std::exception_ptr &exceptionPtr)> completion);
void holdFinalizeCReq(
std::function<void(std::exception_ptr &exceptionPtr)> completion);
MrnttNonViralPostingInvoker initializeCReq(
std::exception_ptr &exceptionPtr,
@@ -58,12 +61,7 @@ protected:
private:
std::unique_ptr<boost::asio::signal_set> signals;
bool callShutdownSalmanoff = false;
std::optional<MrnttNonViralPostingInvoker> initializeCReqInvoker;
std::optional<MrnttNonViralPostingInvoker> finalizeCReqInvoker;
public:
std::exception_ptr initializeLifetimeExceptionPtr;
std::exception_ptr finalizeLifetimeExceptionPtr;
sscl::co::NonViralTaskNursery taskNursery;
};
extern std::shared_ptr<sscl::PuppeteerThread> thread;