Holoscan SDK v4.2.0

Class SidecarDispatchQueue

class SidecarDispatchQueue

Thread-safe queue + dispatch thread for deferred native-descriptor sidecar receives.

Both the DDS and Zenoh transports receive native-descriptor messages on a transport callback thread that must not block. This queue decouples receive from dispatch: the transport callback enqueues items, and a dedicated thread dequeues and delivers them to the PubSubContext receive callback.

Usage: // In transport constructor: sidecar_queue_ = std::make_unique<SidecarDispatchQueue>([this]() { std::lock_guard<std::mutex> lock(my_mutex_); return receive_callback_; });

// When subscribing: sidecar_queue_->start();

// On transport callback thread: sidecar_queue_->enqueue(gid, std::move(payload), metadata);

// On shutdown: sidecar_queue_->stop();

Public Types

using ReceiveCallback = nvidia::gxf::PubSubTransport::ReceiveCallback
using CallbackProvider = std::function<ReceiveCallback()>

Function that returns the current receive callback (thread-safe copy). Called on the dispatch thread before each delivery.

Public Functions

explicit SidecarDispatchQueue(CallbackProvider get_callback)
~SidecarDispatchQueue()
SidecarDispatchQueue(const SidecarDispatchQueue&) = delete
SidecarDispatchQueue &operator=(const SidecarDispatchQueue&) = delete
void start()

Start the dispatch thread. No-op if already running.

void stop()

Stop the dispatch thread and drain the queue.

void enqueue(nvidia::gxf::Gid publisher_gid, std::vector<uint8_t> &&payload, nvidia::gxf::MessageMetadata metadata)

Enqueue a received sidecar message for dispatch. Thread-safe.

Previous Class SessionTransportFrontend
Next Class SignalHandler
© Copyright 2022-2026, NVIDIA. Last updated on May 11, 2026