| 256 | } |
| 257 | |
| 258 | int ACE_TMAIN(int argc, ACE_TCHAR* argv[]) |
| 259 | { |
| 260 | DDS::DomainParticipantFactory_var dpf = TheParticipantFactoryWithArgs(argc, argv); |
| 261 | DDS::DomainParticipantQos participant_qos; |
| 262 | dpf->get_default_participant_qos(participant_qos); |
| 263 | DDS::PropertySeq& properties = participant_qos.property.value; |
| 264 | Qos_Helper::append(properties, OpenDDS::RTPS::RTPS_HARVEST_THREAD_STATUS, "true"); |
| 265 | const DDS::DomainId_t domain = 0; |
| 266 | DDS::DomainParticipant_var participant = dpf->create_participant(domain, participant_qos, 0, DEFAULT_STATUS_MASK); |
| 267 | if (!participant) { |
| 268 | ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: main - failed to create participant\n")); |
| 269 | return EXIT_FAILURE; |
| 270 | } |
| 271 | |
| 272 | DDS::Subscriber_var bit_subscriber = participant->get_builtin_subscriber(); |
| 273 | DDS::DataReader_var reader = bit_subscriber->lookup_datareader(OpenDDS::DCPS::BUILT_IN_INTERNAL_THREAD_TOPIC); |
| 274 | InternalThreadBuiltinTopicDataDataReader_var itbtd_reader = InternalThreadBuiltinTopicDataDataReader::_narrow(reader); |
| 275 | if (!itbtd_reader) { |
| 276 | ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: main - failed to narrow internal thread builtin topic data reader\n")); |
| 277 | return EXIT_FAILURE; |
| 278 | } |
| 279 | |
| 280 | DDS::ReadCondition_var read_cond = reader->create_readcondition(DDS::NOT_READ_SAMPLE_STATE, DDS::ANY_VIEW_STATE, DDS::ANY_INSTANCE_STATE); |
| 281 | DDS::WaitSet_var ws = new DDS::WaitSet; |
| 282 | ws->attach_condition(read_cond); |
| 283 | |
| 284 | // Run test with initial config |
| 285 | const DDS::UInt32 initial_interval = TheServiceParticipant->config_store()->get_uint32( |
| 286 | OpenDDS::DCPS::COMMON_DCPS_THREAD_STATUS_INTERVAL, 0); |
| 287 | if (!wait_for_thread_status_interval(TimeDuration(initial_interval))) { |
| 288 | return EXIT_FAILURE; |
| 289 | } |
| 290 | int ret = tsm_test(itbtd_reader, ws); |
| 291 | |
| 292 | if (ret == EXIT_SUCCESS) { |
| 293 | const char* const status_prop = OpenDDS::DCPS::COMMON_DCPS_THREAD_STATUS_INTERVAL; |
| 294 | OpenDDS::DCPS::RcHandle<OpenDDS::DCPS::ConfigStoreImpl> config_store = |
| 295 | TheServiceParticipant->config_store(); |
| 296 | |
| 297 | // Turn off thread status reporting and expect no messages |
| 298 | const DDS::UInt32 orig = config_store->get_uint32(status_prop, 0); |
| 299 | config_store->set_uint32(status_prop, 0); |
| 300 | // Unfortunatly, we don't have a "clean" way to wait for the config change to propagate all the |
| 301 | // way into the SPDP timer's cancelation, only into the Service_Partipant config store, |
| 302 | // so the safest thing to do here is just wait until we know for sure the timer is definitely done |
| 303 | ACE_OS::sleep(1); // Assume any updates here are pre-cancelation updates (config still propagating) |
| 304 | const DDS::Duration_t waittime = {5, 0}; |
| 305 | DDS::ConditionSeq active; |
| 306 | DDS::ReturnCode_t rc = ws->wait(active, waittime); |
| 307 | if (rc != DDS::RETCODE_TIMEOUT) { |
| 308 | ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: got unexpected thread status message\n")); |
| 309 | ret = EXIT_FAILURE; |
| 310 | } |
| 311 | |
| 312 | // Turn it back on do the testing again |
| 313 | if (ret == EXIT_SUCCESS) { |
| 314 | config_store->set_uint32(status_prop, orig); |
| 315 | if (!wait_for_thread_status_interval(TimeDuration(orig))) { |
nothing calls this directly
no test coverage detected