Waiting for Acknowledgments in a DataWriter

The DataWriter’s wait_for_acknowledgments() operation blocks the calling thread until either all data written by the reliable DataWriter is acknowledged by (a) all reliable DataReaders that are matched and alive and (b) by all required subscriptions (see Required Subscriptions), or until the duration specified by the max_wait parameter elapses, whichever happens first.

Note that if a thread is blocked in the call to wait_for_acknowledgments() on a DataWriter and a different thread writes new DDS samples on the same DataWriter, the new DDS samples must be acknowledged before unblocking the thread waiting on wait_for_acknowledgments().

DDS_ReturnCode_t wait_for_acknowledgments (
	const DDS_Duration_t &  max_wait)

This operation returns DDS_RETCODE_OK if all the DDS samples were acknowledged, or DDS_RETCODE_TIMEOUT if the max_wait duration expired first.

If the DataWriter does not have its RELIABILITY QosPolicy kind set to RELIABLE, the operation will immediately return DDS_RETCODE_OK.

There is a similar operation available at the Publisher level, see Waiting for Acknowledgments in a Publisher.

The reliability protocol used by Connext DDS is discussed in Reliable Communications. The application acknowledgment mechanism is discussed in Application Acknowledgment and Guaranteed Delivery of Data.

© 2018 RTI