diff options
author | thrall <thrall@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-04-14 18:37:30 +0000 |
---|---|---|
committer | thrall <thrall@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-04-14 18:37:30 +0000 |
commit | 25cd22646de052c5282c60ece7122fe0991938e1 (patch) | |
tree | a8d39b96fd7b24d0688d34f90f986ce298666872 | |
parent | 5dee63b26c3d004431f71df5679a5d931816696a (diff) | |
download | ATCD-25cd22646de052c5282c60ece7122fe0991938e1.tar.gz |
Set size of Kokyu::ConfigInfoSet so no segfault
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Dispatching.cpp | 84 |
1 files changed, 43 insertions, 41 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Dispatching.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Dispatching.cpp index 8f6b6304eed..7dfedd356f2 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Dispatching.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Kokyu_Dispatching.cpp @@ -12,48 +12,50 @@ #include "Kokyu/Kokyu.h" -#if ! defined (__ACE_INLINE__) +#if ! defined (__ACE_INLINE__) #include "EC_Kokyu_Dispatching.i" #endif /* __ACE_INLINE__ */ ACE_RCSID(Event, EC_Kokyu_Dispatching, "$Id$") TAO_EC_Kokyu_Dispatching::TAO_EC_Kokyu_Dispatching (TAO_EC_Event_Channel *ec) - : dispatcher_(0) + : dispatcher_(0) { - CORBA::Object_var tmp = ec->scheduler (); + CORBA::Object_var tmp = ec->scheduler (); this->scheduler_ = RtecScheduler::Scheduler::_narrow (tmp.in ()); } void TAO_EC_Kokyu_Dispatching::activate (void) { - // Query the scheduler to get Config_Infos + // Query the scheduler to get Config_Infos RtecScheduler::Config_Info_Set_var configs; this->scheduler_->get_config_infos(configs.out()); ACE_TRY_CHECK; - // Convert RtecScheduler::Config_Info_Set to Kokyu::ConfigInfoSet - // OK to assume exact correspondence betwen Config_Info and ConfigInfo? - Kokyu::ConfigInfoSet kconfigs; - for(CORBA::ULong i=0; i<configs->length(); ++i) { - kconfigs[i].preemption_priority_ = configs[i].preemption_priority; - kconfigs[i].thread_priority_ = configs[i].thread_priority; - switch (configs[i].dispatching_type) { - case RtecScheduler::STATIC_DISPATCHING: - kconfigs[i].dispatching_type_ = Kokyu::FIFO_DISPATCHING; - break; - case RtecScheduler::DEADLINE_DISPATCHING: - kconfigs[i].dispatching_type_ = Kokyu::DEADLINE_DISPATCHING; - break; - case RtecScheduler::LAXITY_DISPATCHING: - kconfigs[i].dispatching_type_ = Kokyu::LAXITY_DISPATCHING; - break; - } + //might be no Config_Infos in the set (if none passed to scheduler_) + + // Convert RtecScheduler::Config_Info_Set to Kokyu::ConfigInfoSet + // OK to assume exact correspondence betwen Config_Info and ConfigInfo? + Kokyu::ConfigInfoSet kconfigs(configs->length()); + for(CORBA::ULong i=0; i<configs->length(); ++i) { + kconfigs[i].preemption_priority_ = configs[i].preemption_priority; + kconfigs[i].thread_priority_ = configs[i].thread_priority; + switch (configs[i].dispatching_type) { + case RtecScheduler::STATIC_DISPATCHING: + kconfigs[i].dispatching_type_ = Kokyu::FIFO_DISPATCHING; + break; + case RtecScheduler::DEADLINE_DISPATCHING: + kconfigs[i].dispatching_type_ = Kokyu::DEADLINE_DISPATCHING; + break; + case RtecScheduler::LAXITY_DISPATCHING: + kconfigs[i].dispatching_type_ = Kokyu::LAXITY_DISPATCHING; + break; + } } - // Create Kokyu::Dispatcher using factory - this->dispatcher_ = Kokyu::Dispatcher_Factory::create_dispatcher(kconfigs); + // Create Kokyu::Dispatcher using factory + this->dispatcher_ = Kokyu::Dispatcher_Factory::create_dispatcher(kconfigs); } void @@ -65,32 +67,32 @@ TAO_EC_Kokyu_Dispatching::shutdown (void) void TAO_EC_Kokyu_Dispatching::push (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - const RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) + RtecEventComm::PushConsumer_ptr consumer, + const RtecEventComm::EventSet& event, + TAO_EC_QOS_Info& qos_info + ACE_ENV_ARG_DECL) { RtecEventComm::EventSet event_copy = event; - this->push_nocopy (proxy, consumer, event_copy, qos_info ACE_ENV_ARG_PARAMETER); + this->push_nocopy (proxy, consumer, event_copy, qos_info ACE_ENV_ARG_PARAMETER); } void TAO_EC_Kokyu_Dispatching::push_nocopy (TAO_EC_ProxyPushSupplier* proxy, - RtecEventComm::PushConsumer_ptr consumer, - RtecEventComm::EventSet& event, - TAO_EC_QOS_Info& qos_info - ACE_ENV_ARG_DECL) + RtecEventComm::PushConsumer_ptr consumer, + RtecEventComm::EventSet& event, + TAO_EC_QOS_Info& qos_info + ACE_ENV_ARG_DECL) { - if (this->dispatcher_ == 0) - this->activate(); + if (this->dispatcher_ == 0) + this->activate(); - // Create Dispatch_Command - TAO_EC_Kokyu_Push_Command *cmd = new TAO_EC_Kokyu_Push_Command(proxy,consumer,event); + // Create Dispatch_Command + TAO_EC_Kokyu_Push_Command *cmd = new TAO_EC_Kokyu_Push_Command(proxy,consumer,event); - // Convert TAO_EC_QOS_Info to QoSDescriptor - RtecScheduler::RT_Info *rt_info = this->scheduler_->get(qos_info.rt_info); + // Convert TAO_EC_QOS_Info to QoSDescriptor + RtecScheduler::RT_Info *rt_info = this->scheduler_->get(qos_info.rt_info); Kokyu::QoSDescriptor qosd; - qosd.preemption_priority_ = qos_info.preemption_priority; + qosd.preemption_priority_ = qos_info.preemption_priority; qosd.deadline_ = rt_info->period; qosd.execution_time_ = rt_info->worst_case_execution_time; @@ -120,7 +122,7 @@ int TAO_EC_Kokyu_Push_Command::execute (ACE_ENV_SINGLE_ARG_DECL) { this->proxy_->push_to_consumer (this->consumer_.in (), - this->event_ - ACE_ENV_ARG_PARAMETER); + this->event_ + ACE_ENV_ARG_PARAMETER); return 0; } |