Use DynamicViralPostingInvoker in at/detachStimBuffDeviceCReq

This commit is contained in:
2026-05-31 07:13:53 -04:00
parent c2eea37a7b
commit d1c74a027c
6 changed files with 62 additions and 25 deletions
+6 -2
View File
@@ -452,11 +452,13 @@ attachByCreatingProducer(
} // namespace
sscl::co::ViralNonPostingInvoker<StimBuffDeviceOpResult>
sscl::co::DynamicViralPostingInvoker<StimBuffDeviceOpResult>
livoxGen1_attachDeviceCReq(
[[maybe_unused]] sscl::co::ExplicitPostTarget postTarget,
const std::shared_ptr<device::DeviceAttachmentSpec> &desc,
const std::shared_ptr<sscl::ComponentThread> &componentThread)
{
(void)postTarget;
if (!livoxProto1.livoxProto1_getOrCreateDeviceCReq)
{
throw std::runtime_error(
@@ -482,10 +484,12 @@ livoxGen1_attachDeviceCReq(
co_return co_await attachByCreatingProducer(desc, componentThread);
}
sscl::co::ViralNonPostingInvoker<StimBuffDeviceOpResult>
sscl::co::DynamicViralPostingInvoker<StimBuffDeviceOpResult>
livoxGen1_detachDeviceCReq(
[[maybe_unused]] sscl::co::ExplicitPostTarget postTarget,
const std::shared_ptr<device::DeviceAttachmentSpec> &desc)
{
(void)postTarget;
// Case 1: Check if StimBuffer doesn't exist (early return)
auto stimProducerBase = getStimulusProducer(desc);
if (!stimProducerBase) {
+8 -2
View File
@@ -46,10 +46,16 @@ bool ensureStimBufferAttachedWithoutDuplicates(
sscl::co::ViralNonPostingInvoker<int> livoxGen1_initializeCInd();
sscl::co::ViralNonPostingInvoker<int> livoxGen1_finalizeCInd();
sscl::co::ViralNonPostingInvoker<StimBuffDeviceOpResult> livoxGen1_attachDeviceCReq(
sscl::co::DynamicViralPostingInvoker<StimBuffDeviceOpResult>
livoxGen1_attachDeviceCReq(
sscl::co::ExplicitPostTarget postTarget,
const std::shared_ptr<device::DeviceAttachmentSpec> &desc,
const std::shared_ptr<sscl::ComponentThread> &componentThread);
sscl::co::ViralNonPostingInvoker<StimBuffDeviceOpResult> livoxGen1_detachDeviceCReq(
sscl::co::DynamicViralPostingInvoker<StimBuffDeviceOpResult>
livoxGen1_detachDeviceCReq(
sscl::co::ExplicitPostTarget postTarget,
const std::shared_ptr<device::DeviceAttachmentSpec> &desc);
} // namespace smo::stim_buff
+9 -5
View File
@@ -274,13 +274,15 @@ static sscl::co::ViralNonPostingInvoker<int> xcbWindow_finalizeCInd(void)
co_return 0;
}
static sscl::co::ViralNonPostingInvoker<smo::stim_buff::StimBuffDeviceOpResult>
static sscl::co::DynamicViralPostingInvoker<smo::stim_buff::StimBuffDeviceOpResult>
xcbWindow_attachDeviceCReq(
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& desc,
[[maybe_unused]] sscl::co::ExplicitPostTarget postTarget,
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& desc,
const std::shared_ptr<sscl::ComponentThread>& componentThread)
{
(void)postTarget;
// Not used yet, but may be used later.
(void)componentThread;
(void)componentThread;
try {
g_attachedWindows.emplace_back(
@@ -298,10 +300,12 @@ xcbWindow_attachDeviceCReq(
co_return smo::stim_buff::StimBuffDeviceOpResult{true, desc};
}
static sscl::co::ViralNonPostingInvoker<smo::stim_buff::StimBuffDeviceOpResult>
static sscl::co::DynamicViralPostingInvoker<smo::stim_buff::StimBuffDeviceOpResult>
xcbWindow_detachDeviceCReq(
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& spec)
[[maybe_unused]] sscl::co::ExplicitPostTarget postTarget,
const std::shared_ptr<smo::device::DeviceAttachmentSpec>& spec)
{
(void)postTarget;
auto it = std::find_if(g_attachedWindows.begin(), g_attachedWindows.end(),
[&spec](const std::unique_ptr<xcb_window::AttachedWindow>& window) {
return window->getDeviceAttachmentSpec() == spec;