Async: add TargetedContinuation

This class enables us to consistently represent continuations
that are intended to be posted on a particular target handling
thread. It hols a sh_ptr to the caller so that the target thread
can re-enqueue the response on the caller after processing the
REQ/IND op.
This commit is contained in:
2025-09-11 18:37:48 -04:00
parent f5195450e4
commit b8c931397d
3 changed files with 51 additions and 13 deletions
+7 -5
View File
@@ -72,7 +72,7 @@ std::optional<std::shared_ptr<Device>> DeviceManager::getDevice(
// GetOrCreateDeviceReq nested class implementation
class DeviceManager::GetOrCreateDeviceReq
: public AsynchronousContinuation<livoxProto1_getOrCreateDeviceReqCbFn>
: public smo::AsynchronousContinuation<livoxProto1_getOrCreateDeviceReqCbFn>
{
public:
DeviceManager& deviceManager;
@@ -84,7 +84,8 @@ public:
DeviceManager& mgr,
std::shared_ptr<Device> device,
livoxProto1_getOrCreateDeviceReqCbFn cb)
: AsynchronousContinuation(std::move(cb)),
: smo::AsynchronousContinuation<
livoxProto1_getOrCreateDeviceReqCbFn>(std::move(cb)),
deviceManager(mgr), pendingDevice(device)
{}
@@ -175,9 +176,9 @@ void DeviceManager::getOrCreateDeviceReq(
}
class DeviceManager::DestroyDeviceReq
: public AsynchronousContinuation<livoxProto1_destroyDeviceReqCbFn>
: public smo::AsynchronousContinuation<livoxProto1_destroyDeviceReqCbFn>
{
public:
public:
DeviceManager& deviceManager;
std::shared_ptr<Device> pendingDevice;
@@ -186,7 +187,8 @@ public:
DeviceManager& mgr,
std::shared_ptr<Device> device,
livoxProto1_destroyDeviceReqCbFn cb)
: AsynchronousContinuation(std::move(cb)),
: smo::AsynchronousContinuation<
livoxProto1_destroyDeviceReqCbFn>(std::move(cb)),
deviceManager(mgr), pendingDevice(device)
{}