MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / wait_for_data

Function wait_for_data

tests/DCPS/ZeroCopyRead/main.cpp:211–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209
210
211bool wait_for_data(::DDS::Subscriber_ptr sub, int timeout_sec)
212{
213 const int factor = 10;
214 ACE_Time_Value small_time(0,1000000/factor);
215 int timeout_loops = timeout_sec * factor;
216
217 ::DDS::DataReaderSeq_var discard = new ::DDS::DataReaderSeq(10);
218 while (timeout_loops-- > 0)
219 {
220 sub->get_datareaders (
221 discard.inout (),
222 ::DDS::NOT_READ_SAMPLE_STATE,
223 ::DDS::ANY_VIEW_STATE,
224 ::DDS::ANY_INSTANCE_STATE );
225 if (discard->length () > 0)
226 return true;
227
228 ACE_OS::sleep (small_time);
229 }
230 return false;
231}
232
233/// parse the command line arguments
234int parse_args (int argc, ACE_TCHAR *argv[])

Callers 1

ACE_TMAINFunction · 0.70

Calls 3

get_datareadersMethod · 0.45
inoutMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected