StimProd,DevReattacher: use CDaemon nonviral nursery coro

We ported these two daemons over to the new nursery mechanism and
they work nicely.
This commit is contained in:
2026-06-09 19:47:44 -04:00
parent 165c846700
commit 87a8de9a2b
6 changed files with 136 additions and 124 deletions
@@ -428,28 +428,16 @@ PcloudStimulusProducer::getOrCreateAttachedStimulusBuffer(
}
}
struct AllowNextStimulusFrameGuard
{
PcloudStimulusProducer& producer;
explicit AllowNextStimulusFrameGuard(PcloudStimulusProducer& _producer)
: producer(_producer)
{}
~AllowNextStimulusFrameGuard()
{ producer.allowNextStimulusFrame(); }
};
/** EXPLANATION:
* productionCDaemon co_awaits this viral timeslice and passes its
* nursery-slot canceler. Cooperative shutdown uses that canceler between
* co_await steps; do not use execUncancelableSegmentOrAbort here.
* nursery-slot canceler. Cadence (timeslice stamp, residue sleep, overrun
* detection) is owned by StimulusProducer::productionCDaemon. Cooperative
* shutdown uses the canceler between co_await steps.
*/
sscl::co::ViralNonPostingInvoker<void>
PcloudStimulusProducer::stimFrameProductionTimesliceCInd(
sscl::SyncCancelerForAsyncWork &canceler)
{
AllowNextStimulusFrameGuard allowNextGuard(*this);
StimulusFrame& stimulusFrame = tempStimulusFrame;
sscl::AsynchronousLoop frameAssemblyResult(0);
std::optional<std::reference_wrapper<StimulusFrame>> intensityStimFrame;
@@ -459,11 +447,6 @@ PcloudStimulusProducer::stimFrameProductionTimesliceCInd(
auto& resumeIoContext = device->componentThread->getIoContext();
// produceFrameReq1_doAssemble_posted
/** EXPLANATION:
* productionCDaemon co_awaits this timeslice outside its uncancelable
* rate-limiter segment; use isCancellationRequested() here, not
* execUncancelableSegmentOrAbort.
*/
if (canceler.isCancellationRequested())
{ co_return; }