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

Method svc

tools/monitor/MonitorTask.cpp:269–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267}
268
269int
270Monitor::MonitorTask::svc()
271{
272 this->thread_ = ACE_OS::thr_self();
273
274 if( this->options_.verbose()) {
275 ACE_DEBUG((LM_DEBUG,
276 ACE_TEXT("(%P|%t) MonitorTask::svc() - ")
277 ACE_TEXT("processing starts on thread.\n")
278 ));
279 }
280
281 DDS::Duration_t timeout = { DDS::DURATION_INFINITE_SEC, DDS::DURATION_INFINITE_NSEC};
282 DDS::ConditionSeq conditions;
283
284 while( !this->done_) {
285 if( this->options_.verbose()) {
286 ACE_DEBUG((LM_DEBUG,
287 ACE_TEXT("(%P|%t) MonitorTask::svc() - ")
288 ACE_TEXT("waiting for work.\n")
289 ));
290 }
291
292 // Clear previous conditions.
293 conditions.length(0);
294 if( DDS::RETCODE_OK != this->waiter_->wait( conditions, timeout)) {
295 ACE_ERROR((LM_ERROR,
296 ACE_TEXT("(%P|%t) ERROR: MonitorTask::svc() - ")
297 ACE_TEXT("failed to synchronize DDS conditions.\n")
298 ));
299 return -1;
300 }
301
302 if( this->options_.verbose()) {
303 ACE_DEBUG((LM_DEBUG,
304 ACE_TEXT("(%P|%t) MonitorTask::svc() - ")
305 ACE_TEXT("processing conditions.\n")
306 ));
307 }
308
309 ACE_GUARD_RETURN(ACE_SYNCH_MUTEX, guard, this->lock_, -1);
310
311 for( unsigned long index = 0; index < conditions.length(); ++index) {
312 // Extract the current Condition.
313 DDS::StatusCondition_var condition
314 = DDS::StatusCondition::_narrow( conditions[ index].in());
315 if( !CORBA::is_nil( condition.in())) {
316 if( this->options_.verbose()) {
317 ACE_DEBUG((LM_DEBUG,
318 ACE_TEXT("(%P|%t) MonitorTask::svc() - ")
319 ACE_TEXT("processing condition for instance %d.\n"),
320 condition->get_entity()->get_instance_handle()
321 ));
322 }
323 // It's a CommunicationStatus, process inbound data.
324 DDS::DataReader_var reader
325 = DDS::DataReader::_narrow( condition->get_entity());
326 if( !CORBA::is_nil( reader.in())) {

Callers

nothing calls this directly

Calls 7

dispatchReaderMethod · 0.95
get_entityMethod · 0.80
verboseMethod · 0.45
lengthMethod · 0.45
waitMethod · 0.45
inMethod · 0.45
get_instance_handleMethod · 0.45

Tested by

no test coverage detected