Multiple Data Readers and Data writers in a single c++ file

2 posts / 0 new
Last post
Offline
Last seen: 5 years 5 months ago
Joined: 11/01/2018
Posts: 1
Multiple Data Readers and Data writers in a single c++ file

Hello,

I am trying to create multiple Data Readers and Data writers in a single c++ file. I'm designing my application in this way : 

  • A single DDS Publisher let us call it pubA uses a data writer dwA to write the data on a topic T1.
  • A DDS Subscriber let us call it subB uses a data reader drB to read the data. 
  • After the data is read by the routine in subA, I am using another data writer dwB to write the data to another topic T2 inside this routine.
  • I now have implemented another data reader drA in pubA which is reading data on topic T2. 
  • I'm not sure why but dwB isn't writing data. I'm getting a segmentation fault. 

I am using the same participants to create the subscribers and publishers in the files. 

Is there another way of implementing multiple data writers and data readers in the same file?

sara's picture
Offline
Last seen: 1 year 4 months ago
Joined: 01/16/2013
Posts: 128

Hi akshays,

First of all, using multiple DRs and DWs inside the same Subscribers/Publishers and Domain Participants (and in the same file) is fully supported.

When you say that you are using dwB to write data, are you doing that inside the callback of reading data?
If so, take into account that you should not do that, you can see more details on restrict operations in listeners.

Otherwise, could you share a reproducer of your problem? 

Thanks,
Sara