diff options
Diffstat (limited to 'TAO/examples/RTScheduling/POA_Holder.cpp')
-rw-r--r-- | TAO/examples/RTScheduling/POA_Holder.cpp | 175 |
1 files changed, 86 insertions, 89 deletions
diff --git a/TAO/examples/RTScheduling/POA_Holder.cpp b/TAO/examples/RTScheduling/POA_Holder.cpp index 605979bb28f..3013a8769f7 100644 --- a/TAO/examples/RTScheduling/POA_Holder.cpp +++ b/TAO/examples/RTScheduling/POA_Holder.cpp @@ -1,11 +1,8 @@ //$Id$ - #include "POA_Holder.h" - -#include "tao/debug.h" - #include "ace/Arg_Shifter.h" #include "ace/Log_Msg.h" +#include "tao/debug.h" POA_Holder::POA_Holder (void) :priority_model_ (RTCORBA::CLIENT_PROPAGATED), @@ -18,7 +15,7 @@ int POA_Holder::init (ACE_Arg_Shifter& arg_shifter) { ACE_DEBUG ((LM_DEBUG, - "Init POA\n")); + "Init POA\n")); const ACE_TCHAR *current_arg = 0; @@ -69,35 +66,35 @@ POA_Holder::init (ACE_Arg_Shifter& arg_shifter) lanes_[l_index].lane_priority, lanes_[l_index].static_threads, lanes_[l_index].dynamic_threads)); l_index++; } - else + else break; } /* while -- lane values */ } /* if -Lanes */ else if (arg_shifter.cur_arg_strncasecmp ("-ThreadPool") == 0) - { - ACE_DEBUG ((LM_DEBUG, - "Thread Pool\n")); - - arg_shifter.consume_arg (); - thread_pool_ = 1; - // read priority - tp_static_threads_ = ACE_OS::atoi (arg_shifter.get_current ()); - arg_shifter.consume_arg (); - - tp_dynamic_threads_ = ACE_OS::atoi (arg_shifter.get_current ()); - arg_shifter.consume_arg (); - - tp_priority_ = ACE_OS::atoi (arg_shifter.get_current ()); - arg_shifter.consume_arg (); - ACE_DEBUG ((LM_DEBUG, - "Thread Pool Initialized\n")); - - } + { + ACE_DEBUG ((LM_DEBUG, + "Thread Pool\n")); + + arg_shifter.consume_arg (); + thread_pool_ = 1; + // read priority + tp_static_threads_ = ACE_OS::atoi (arg_shifter.get_current ()); + arg_shifter.consume_arg (); + + tp_dynamic_threads_ = ACE_OS::atoi (arg_shifter.get_current ()); + arg_shifter.consume_arg (); + + tp_priority_ = ACE_OS::atoi (arg_shifter.get_current ()); + arg_shifter.consume_arg (); + ACE_DEBUG ((LM_DEBUG, + "Thread Pool Initialized\n")); + + } else if ((current_arg = arg_shifter.get_the_parameter ("-Bands"))) { - ACE_DEBUG ((LM_DEBUG, - "Initializing Bands\n")); + ACE_DEBUG ((LM_DEBUG, + "Initializing Bands\n")); int bandcount = ACE_OS::atoi (current_arg); bands_.length (bandcount); @@ -127,20 +124,20 @@ POA_Holder::init (ACE_Arg_Shifter& arg_shifter) else break; } /* while -- Band values */ - ACE_DEBUG ((LM_DEBUG, - "Bands Initialized\n")); + ACE_DEBUG ((LM_DEBUG, + "Bands Initialized\n")); } /* if -Bands */ else // something else is showing up ... { - ACE_DEBUG ((LM_DEBUG, - "Finish Init POA\n")); - + ACE_DEBUG ((LM_DEBUG, + "Finish Init POA\n")); + return 0; } } ACE_DEBUG ((LM_DEBUG, - "Finish Init POA\n")); + "Finish Init POA\n")); return 0; } @@ -186,8 +183,8 @@ POA_Holder::activate (RTCORBA::RTORB_ptr rt_orb, PortableServer::POA_ptr parent_ ACE_CHECK; ACE_DEBUG ((LM_DEBUG, - "Activated Lanes\n")); - + "Activated Lanes\n")); + } if (thread_pool_) @@ -196,7 +193,7 @@ POA_Holder::activate (RTCORBA::RTORB_ptr rt_orb, PortableServer::POA_ptr parent_ CORBA::Boolean allow_request_buffering = 0; CORBA::ULong max_buffered_requests = 0; CORBA::ULong max_request_buffer_size = 0; - + RTCORBA::ThreadpoolId threadpool_id_1 = rt_orb->create_threadpool (stacksize, tp_static_threads_, @@ -210,13 +207,13 @@ POA_Holder::activate (RTCORBA::RTORB_ptr rt_orb, PortableServer::POA_ptr parent_ thread_pool_policy = rt_orb->create_threadpool_policy (threadpool_id_1 - ACE_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_CHECK; ACE_DEBUG ((LM_DEBUG, - "Activated thread pool\n")); - - + "Activated thread pool\n")); + + } if (bands_.length () != 0) @@ -227,8 +224,8 @@ POA_Holder::activate (RTCORBA::RTORB_ptr rt_orb, PortableServer::POA_ptr parent_ ACE_ENV_ARG_PARAMETER); ACE_CHECK; ACE_DEBUG ((LM_DEBUG, - "Activated Bands\n")); - + "Activated Bands\n")); + } CORBA::PolicyList poa_policy_list; @@ -236,70 +233,70 @@ POA_Holder::activate (RTCORBA::RTORB_ptr rt_orb, PortableServer::POA_ptr parent_ if (lanes_.length () == 0 && bands_.length () == 0) { if (thread_pool_) - { - poa_policy_list.length (2); - poa_policy_list[0] = priority_model_policy; - poa_policy_list[1] = thread_pool_policy; - } - else - { - poa_policy_list.length (1); - poa_policy_list[0] = priority_model_policy; - } + { + poa_policy_list.length (2); + poa_policy_list[0] = priority_model_policy; + poa_policy_list[1] = thread_pool_policy; + } + else + { + poa_policy_list.length (1); + poa_policy_list[0] = priority_model_policy; + } } else if (lanes_.length () != 0 && bands_.length () == 0) { if (thread_pool_) - { - poa_policy_list.length (3); - poa_policy_list[0] = priority_model_policy; - poa_policy_list[1] = lanes_policy; - poa_policy_list[2] = thread_pool_policy; - } - else - { - poa_policy_list.length (2); - poa_policy_list[0] = priority_model_policy; - poa_policy_list[1] = lanes_policy; - } + { + poa_policy_list.length (3); + poa_policy_list[0] = priority_model_policy; + poa_policy_list[1] = lanes_policy; + poa_policy_list[2] = thread_pool_policy; + } + else + { + poa_policy_list.length (2); + poa_policy_list[0] = priority_model_policy; + poa_policy_list[1] = lanes_policy; + } } else if (lanes_.length () == 0 && bands_.length () != 0) { if (thread_pool_) - { - poa_policy_list.length (3); - poa_policy_list[0] = priority_model_policy; - poa_policy_list[1] = bands_policy; - poa_policy_list[2] = thread_pool_policy; - } + { + poa_policy_list.length (3); + poa_policy_list[0] = priority_model_policy; + poa_policy_list[1] = bands_policy; + poa_policy_list[2] = thread_pool_policy; + } else - { - poa_policy_list.length (2); - poa_policy_list[0] = priority_model_policy; - poa_policy_list[1] = bands_policy; - } + { + poa_policy_list.length (2); + poa_policy_list[0] = priority_model_policy; + poa_policy_list[1] = bands_policy; + } } else { if (thread_pool_) - { - poa_policy_list.length (4); - poa_policy_list[0] = priority_model_policy; - poa_policy_list[1] = lanes_policy; - poa_policy_list[2] = bands_policy; - poa_policy_list[3] = thread_pool_policy; - } + { + poa_policy_list.length (4); + poa_policy_list[0] = priority_model_policy; + poa_policy_list[1] = lanes_policy; + poa_policy_list[2] = bands_policy; + poa_policy_list[3] = thread_pool_policy; + } else - { - poa_policy_list.length (3); - poa_policy_list[0] = priority_model_policy; - poa_policy_list[1] = lanes_policy; - poa_policy_list[2] = bands_policy; - } + { + poa_policy_list.length (3); + poa_policy_list[0] = priority_model_policy; + poa_policy_list[1] = lanes_policy; + poa_policy_list[2] = bands_policy; + } } ACE_DEBUG ((LM_DEBUG, - "Initialized POA Policy\n")); + "Initialized POA Policy\n")); if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "creating POA %s\n", POA_name_.c_str ())); |