Blocking write in DataWriter

2 posts / 0 new
Last post
Juanjo Martin's picture
Last seen: 1 year 9 months ago
Joined: 07/23/2012
Posts: 48
Blocking write in DataWriter

Hello RTI users,


I've got some questions about DataWriters:


  1. Does Blocking Write during transmission involves a context switching? (RTI_Connext_UsersManual,
  2. I need the current ocupation percentage of the DataWriter's send window, so Im using DDS_ReliableWriterCacheChangedStatus.unacknowledged_sample_count as the current number of samples in the window and DDS_DataWriterProtocolStatus.send_window_size as the current window size. Am I in the correct way or I'm wrong?
I will be grateful for any help you can provide,
Juan J. Martin.
Gerardo Pardo's picture
Last seen: 1 week 1 day ago
Joined: 06/02/2010
Posts: 602




1) Yes, if the write operation blocks under the circumstances described in the manual and in the on-line doc (see then the thread that called DataWriter::write()  will be blocked on a binary semaphore and there will be a context switch to another thread and a context switch back to it when the reason for the blocking goes away (or the timeout arrives) and the binary semaphore is signalled.


2) Yes, at any point in time the DataWriter has a 'send_window' that defines the maximum number of samples unacknowledged by one or more active reliable readers. The size of this window can change dynamically between the limits imposed by the DataWriterProtocolQosPolicy (  See the attributes: DataWriterProtocolQosPolicy.rtps_reliable_writer.min_send_window_size and DataWriterProtocolQosPolicy.rtps_reliable_writer.max_send_window_size

The current value of the 'send_window' is indeed accessible as the DDS_DataWriterProtocolStatus.send_window_size


Yes, the current number of number of unacknowledged samples by one or more active reliable readers is indeed accessible as the DDS_ReliableWriterCacheChangedStatus.unacknowledged_sample_count  so the percentage of occupation of the send window is:  



Note however that there is an internal algorithm that is adjusting the send_window_size  based on a measurement of network congestion. See the documentation for send_window_update_period , send_window_increase_factor, and similar fields under  so if what you are trying to do is adjust the send rate based on the percentage of occupation you need to think about how this would interact with this algorithm...