Modern C++ Data Samples

2 posts / 0 new
Last post
Offline
Last seen: 1 year 10 months ago
Joined: 09/12/2014
Posts: 6
Modern C++ Data Samples

 

I am using Modern C++ version of DDS 5.3.1

In my DataReaderListener''s on_data_available() callback function, the data samples is in the DDS Thread.

dds::sub::LoanedSamples<My_Cmd> samples = reader.read();

i want to do a PostMessage to the Main Thread. Is it ok to to do the following

My_Cmd MySample = samples[0];

PostMessage(_myHWND, WM_DATA, (WPARAM)(&MySample),0);

As far as i know its not recommended to use pointers in the Modern C++ API does it apply to Data samples?

 

 

 

 

sara's picture
Offline
Last seen: 3 weeks 2 days ago
Joined: 01/16/2013
Posts: 128

Hi Calvin,

If you want to get the data in your main thread, have you considered using waitsets? In many cases, waitset is a better option than callbacks.

You can find a example here, and there are some snippets and info in the manuals.

Let me know if that's closer to what you need or if you still prefer the PostMessage option.

Thanks,
Sara