From 31d71bffb2bd36047dd8a8d1110abb8076115b5f Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Wed, 30 Dec 2020 10:03:07 +0100 Subject: Make use of std atomic and unique_ptr * TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.cpp: * TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.h: * TAO/orbsvcs/tests/EC_Multiple/README: --- TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.cpp | 24 ++++++++++++------------ TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.h | 5 +++-- TAO/orbsvcs/tests/EC_Multiple/README | 4 +--- 3 files changed, 16 insertions(+), 17 deletions(-) (limited to 'TAO') diff --git a/TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.cpp b/TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.cpp index d254b7c1773..b94687511fa 100644 --- a/TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.cpp +++ b/TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.cpp @@ -16,10 +16,10 @@ #include "tao/ORB_Core.h" #include "ace/Get_Opt.h" -#include "ace/Auto_Ptr.h" #include "ace/Sched_Params.h" #include "ace/OS_NS_errno.h" #include "ace/OS_NS_strings.h" +#include #if defined (sun) # include /* for _lwp_self */ @@ -255,7 +255,7 @@ Test_ECG::run (int argc, ACE_TCHAR* argv[]) CosNaming::NamingContext_var naming_context = CosNaming::NamingContext::_narrow (naming_obj.in ()); - auto_ptr scheduler_impl; + std::unique_ptr scheduler_impl; RtecScheduler::Scheduler_var scheduler; switch (this->scheduling_type_) @@ -269,8 +269,8 @@ Test_ECG::run (int argc, ACE_TCHAR* argv[]) case Test_ECG::ss_local: { - auto_ptr auto_scheduler_impl (new ACE_Config_Scheduler); - scheduler_impl = auto_scheduler_impl; + std::unique_ptr auto_scheduler_impl (new ACE_Config_Scheduler); + scheduler_impl = std::move(auto_scheduler_impl); } if (scheduler_impl.get () == 0) return -1; @@ -287,12 +287,12 @@ Test_ECG::run (int argc, ACE_TCHAR* argv[]) sizeof (runtime_infos_1)/sizeof (runtime_infos_1[0]), runtime_infos_1); - auto_ptr auto_scheduler_impl + std::unique_ptr auto_scheduler_impl (new ACE_Runtime_Scheduler (runtime_configs_1_size, runtime_configs_1, runtime_infos_1_size, runtime_infos_1)); - scheduler_impl = auto_scheduler_impl; + scheduler_impl = std::move(auto_scheduler_impl); if (scheduler_impl.get () == 0) return -1; @@ -307,12 +307,12 @@ Test_ECG::run (int argc, ACE_TCHAR* argv[]) sizeof (runtime_infos_2)/sizeof (runtime_infos_2[0]), runtime_infos_2); - auto_ptr auto_scheduler_impl + std::unique_ptr auto_scheduler_impl (new ACE_Runtime_Scheduler (runtime_configs_2_size, runtime_configs_2, runtime_infos_2_size, runtime_infos_2)); - scheduler_impl = auto_scheduler_impl; + scheduler_impl = std::move(auto_scheduler_impl); if (scheduler_impl.get () == 0) return -1; @@ -327,12 +327,12 @@ Test_ECG::run (int argc, ACE_TCHAR* argv[]) sizeof (runtime_infos_3)/sizeof (runtime_infos_3[0]), runtime_infos_3); - auto_ptr auto_scheduler_impl + std::unique_ptr auto_scheduler_impl (new ACE_Runtime_Scheduler (runtime_configs_3_size, runtime_configs_3, runtime_infos_3_size, runtime_infos_3)); - scheduler_impl = auto_scheduler_impl; + scheduler_impl = std::move(auto_scheduler_impl); if (scheduler_impl.get () == 0) return -1; @@ -344,8 +344,8 @@ Test_ECG::run (int argc, ACE_TCHAR* argv[]) "Unknown name <%C> defaulting to " "config scheduler\n", this->lcl_name_.c_str ())); - auto_ptr auto_scheduler_impl (new ACE_Config_Scheduler); - scheduler_impl = auto_scheduler_impl; + std::unique_ptr auto_scheduler_impl (new ACE_Config_Scheduler); + scheduler_impl = std::move(auto_scheduler_impl); if (scheduler_impl.get () == 0) return -1; diff --git a/TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.h b/TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.h index 9ba503ad3fe..c0e92439226 100644 --- a/TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.h +++ b/TAO/orbsvcs/tests/EC_Multiple/EC_Multiple.h @@ -27,6 +27,7 @@ #include "orbsvcs/Channel_Clients_T.h" #include "orbsvcs/Event/EC_Gateway_Sched.h" #include "orbsvcs/CosNamingC.h" +#include class Test_ECG; @@ -353,11 +354,11 @@ private: // to setup all the consumers. // The suppliers wait on the condition variable. - ACE_Atomic_Op running_suppliers_; + std::atomic running_suppliers_; // keep track of how many suppliers are still running so we shutdown // at the right moment. - ACE_Atomic_Op running_consumers_; + std::atomic running_consumers_; // keep track of how many consumers are still running so we shutdown // at the right moment. diff --git a/TAO/orbsvcs/tests/EC_Multiple/README b/TAO/orbsvcs/tests/EC_Multiple/README index 01009d37e0c..2306ce9e100 100644 --- a/TAO/orbsvcs/tests/EC_Multiple/README +++ b/TAO/orbsvcs/tests/EC_Multiple/README @@ -1,6 +1,4 @@ - - - This test ilustrates how to connect multiple ECs; it has many + This test illustrates how to connect multiple ECs; it has many options and can be configured to run a single EC, two ECs connected through a Gateway, short-circuit the EC, use a global, local or precomputed schedule, etc. -- cgit v1.2.1