Hi,
I'm trying to understand the receive threads in Connext. My understanding is that when data is available, a receive thread will call the DataReader listener's on_data_available method. Since there can be multiple receive threads (e.g., for different transports), does that mean multiple receive threads could call into on_data_available simultaenously? I'm wondering if I need to synchronize access to class data structures when I'm inside on_data_availble.
Thanks
Hi,
Yes, as you said there are multiple receive threads that could call the on_data_available callback. However all calls into DataReaderListener operations are serialized by a Mutex that is placed on the Subscriber to which the DataReader belongs. This behavior is part of the DDS specification. For this reason listener calls are guranteed to not be concurrent and it is safe to access data structures from any listener callbacks, as long as the listeners are associated with DataReaders belonging to the same Subscriber.
Gerardo