| 267 | } |
| 268 | |
| 269 | int |
| 270 | Monitor::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())) { |
nothing calls this directly
no test coverage detected