diff options
25 files changed, 404 insertions, 163 deletions
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c index f6b10a0d99f..acdfc6feb02 100644 --- a/TAO/ChangeLog-99c +++ b/TAO/ChangeLog-99c @@ -1,3 +1,42 @@ +Fri Feb 5 02:34:27 1999 Carlos O'Ryan <coryan@cs.wustl.edu> + + * orbsvcs/orbsvcs/Event/Dispatching_Modules.cpp: + * orbsvcs/orbsvcs/Event/Dispatching_Modules.h: + * orbsvcs/orbsvcs/Event/EC_Basic_Filter_Builder.cpp: + * orbsvcs/orbsvcs/Event/Event_Channel.cpp: + * orbsvcs/orbsvcs/Event/Event_Channel.h: + * orbsvcs/orbsvcs/Event/Event_Channel.i: + * orbsvcs/orbsvcs/Event/Module_Factory.cpp: + * orbsvcs/orbsvcs/Event/RT_Task.cpp: + * orbsvcs/orbsvcs/Event/RT_Task.h: + * orbsvcs/orbsvcs/Event/ReactorTask.cpp: + * orbsvcs/orbsvcs/Event/ReactorTask.h: + * orbsvcs/orbsvcs/Event/Timer_Module.cpp: + * orbsvcs/orbsvcs/Event/Timer_Module.h: + The Event Channel can receive a reference to the scheduler in + its constructor, this reference is propagated to all the modules + and used instead of the Scheduler_Factory singleton. + This can be used to have more than one Event Channel for process + or to simplify the testing of multiple Scheduling services. + If no scheduler is specified the Event Channel bootstraps from + the Scheduler_Factory as usual. + + * orbsvcs/tests/EC_Throughput/ECT_Throughput.cpp: + * orbsvcs/tests/EC_Throughput/ECT_Consumer.cpp: + * orbsvcs/tests/EC_Throughput/ECT_Consumer.h: + * orbsvcs/tests/EC_Throughput/ECT_Consumer_Driver.cpp: + * orbsvcs/tests/EC_Throughput/ECT_Consumer_Driver.h: + * orbsvcs/tests/EC_Throughput/ECT_Supplier.cpp: + * orbsvcs/tests/EC_Throughput/ECT_Supplier.h: + * orbsvcs/tests/EC_Throughput/ECT_Supplier_Driver.cpp: + * orbsvcs/tests/EC_Throughput/ECT_Supplier_Driver.h: + * orbsvcs/tests/EC_Throughput/ECT_Throughput.cpp: + * orbsvcs/tests/EC_Throughput/ECT_Throughput.h: + * orbsvcs/tests/EC_Basic/EC_Basic.cpp: + It doesn't use the Scheduler_Factory anymore, this illustrates + how the EC can receive the scheduler as an argument. + + Fri Feb 5 02:33:05 1999 Carlos O'Ryan <coryan@cs.wustl.edu> * tao/ORB_Core.cpp: diff --git a/TAO/orbsvcs/orbsvcs/Event/Dispatching_Modules.cpp b/TAO/orbsvcs/orbsvcs/Event/Dispatching_Modules.cpp index 55c57829908..7d810dc4436 100644 --- a/TAO/orbsvcs/orbsvcs/Event/Dispatching_Modules.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/Dispatching_Modules.cpp @@ -190,6 +190,9 @@ ACE_ES_Priority_Dispatching::ACE_ES_Priority_Dispatching (ACE_EventChannel *chan { this->queues_[x] = 0; } + + this->scheduler_ = + this->channel_->scheduler (); } ACE_ES_Priority_Dispatching::~ACE_ES_Priority_Dispatching (void) @@ -214,7 +217,9 @@ ACE_ES_Priority_Dispatching::initialize_queues (void) period_tv.usec () * 10; ACE_NEW (this->queues_[x], - ACE_ES_Dispatch_Queue (this, ¬ification_strategy_)); + ACE_ES_Dispatch_Queue (this, + &this->notification_strategy_, + this->scheduler_.in ())); this->queues_[x]->thr_mgr (&this->thr_mgr_); if ( this->queues_[x]->open_queue (period, @@ -339,17 +344,23 @@ ACE_ES_Priority_Dispatching::push (ACE_ES_Dispatch_Request *request, { // @@ TODO use TAO_TRY&friends ACE_TIMEPROBE (TAO_DISPATCHING_MODULES_PRIORITY_DISPATCHING_PUSH_PRIORITY_REQUESTED); +#if 1 + this->scheduler_->priority + (request->rt_info (), + thread_priority, + subpriority, + preemption_priority, + TAO_IN_ENV); +#else ACE_Scheduler_Factory::server ()->priority (request->rt_info (), thread_priority, subpriority, preemption_priority, TAO_IN_ENV); +#endif ACE_TIMEPROBE (TAO_DISPATCHING_MODULES_PRIORITY_DISPATCHING_PUSH_PRIORITY_OBTAINED); - if (TAO_IN_ENV.exception ()) - { - return; - } + TAO_CHECK_ENV_RETURN_VOID (TAO_IN_ENV); } else { @@ -512,9 +523,12 @@ ACE_ES_Priority_Dispatching::get_handle (void) const // ************************************************************ -ACE_ES_Dispatch_Queue::ACE_ES_Dispatch_Queue (ACE_ES_Dispatching_Base *dispatching_module, - ACE_ES_Notification_Strategy *notification_strategy) - : dispatching_module_ (dispatching_module), +ACE_ES_Dispatch_Queue:: + ACE_ES_Dispatch_Queue (ACE_ES_Dispatching_Base *dispatching_module, + ACE_ES_Notification_Strategy *notification_strategy, + RtecScheduler::Scheduler_ptr scheduler) + : ACE_RT_Task (scheduler), + dispatching_module_ (dispatching_module), notification_strategy_ (notification_strategy) { } @@ -604,6 +618,20 @@ ACE_ES_Dispatch_Queue::open_queue (RtecScheduler::Period_t &period, { TAO_TRY {// @@ TODO: Handle exceptions... +#if 1 + this->scheduler_->set + (rt_info_, + RtecScheduler::VERY_HIGH_CRITICALITY, + ORBSVCS_Time::zero, + ORBSVCS_Time::zero, + ORBSVCS_Time::zero, + period, + RtecScheduler::VERY_LOW_IMPORTANCE, + ORBSVCS_Time::zero, + 1, + RtecScheduler::OPERATION, + TAO_TRY_ENV); +#else ACE_Scheduler_Factory::server()->set (rt_info_, RtecScheduler::VERY_HIGH_CRITICALITY, ORBSVCS_Time::zero, @@ -615,6 +643,7 @@ ACE_ES_Dispatch_Queue::open_queue (RtecScheduler::Period_t &period, 1, RtecScheduler::OPERATION, TAO_TRY_ENV); +#endif TAO_CHECK_ENV; } TAO_CATCHANY diff --git a/TAO/orbsvcs/orbsvcs/Event/Dispatching_Modules.h b/TAO/orbsvcs/orbsvcs/Event/Dispatching_Modules.h index 17fbf06b9b9..9edac9620c6 100644 --- a/TAO/orbsvcs/orbsvcs/Event/Dispatching_Modules.h +++ b/TAO/orbsvcs/orbsvcs/Event/Dispatching_Modules.h @@ -330,7 +330,9 @@ class TAO_ORBSVCS_Export ACE_ES_Dispatch_Queue : public ACE_RT_Task { public: ACE_ES_Dispatch_Queue (ACE_ES_Dispatching_Base *dispatching_module, - ACE_ES_Notification_Strategy *notification_strategy); + ACE_ES_Notification_Strategy *notification_strategy, + RtecScheduler::Scheduler_ptr scheduler = + RtecScheduler::Scheduler::_nil ()); // Stores <dispatching_module> for this->threads_closed. Stores // away <notification_strategy> for this->synch_threads. @@ -448,6 +450,9 @@ protected: ACE_RT_Thread_Manager thr_mgr_; // The thread manager for the threads of this object. + + RtecScheduler::Scheduler_var scheduler_; + // The scheduler. }; // ************************************************************ diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Basic_Filter_Builder.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Basic_Filter_Builder.cpp index 7f68036691a..105794b8d1b 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Basic_Filter_Builder.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Basic_Filter_Builder.cpp @@ -32,29 +32,31 @@ TAO_EC_Basic_Filter_Builder:: const RtecEventComm::Event& e = qos.dependencies[pos].event; if (e.header.type == ACE_ES_CONJUNCTION_DESIGNATOR) { + pos++; // Consume the designator CORBA::ULong n = this->count_children (qos, pos); TAO_EC_Filter** children; ACE_NEW_RETURN (children, TAO_EC_Filter*[n], 0); for (CORBA::ULong i = 0; i != n; ++i) { - pos++; children[i] = this->recursive_build (qos, pos); + pos++; } return new TAO_EC_Conjunction_Filter (children, n); } - else if (e.header.type == ACE_ES_CONJUNCTION_DESIGNATOR) + else if (e.header.type == ACE_ES_DISJUNCTION_DESIGNATOR) { + pos++; // Consume the designator CORBA::ULong n = this->count_children (qos, pos); TAO_EC_Filter** children; ACE_NEW_RETURN (children, TAO_EC_Filter*[n], 0); for (CORBA::ULong i = 0; i != n; ++i) { - pos++; children[i] = this->recursive_build (qos, pos); + pos++; } - return new TAO_EC_Conjunction_Filter (children, n); + return new TAO_EC_Disjunction_Filter (children, n); } return new TAO_EC_Type_Filter (e.header); } @@ -65,8 +67,8 @@ TAO_EC_Basic_Filter_Builder:: CORBA::ULong pos) const { CORBA::ULong l = qos.dependencies.length (); - for (CORBA::ULong i = 1; - i + pos != l; + for (CORBA::ULong i = pos; + i != l; ++i) { const RtecEventComm::Event& e = qos.dependencies[i].event; @@ -74,5 +76,5 @@ TAO_EC_Basic_Filter_Builder:: || e.header.type == ACE_ES_DISJUNCTION_DESIGNATOR) break; } - return i; + return i - 1; } diff --git a/TAO/orbsvcs/orbsvcs/Event/Event_Channel.cpp b/TAO/orbsvcs/orbsvcs/Event/Event_Channel.cpp index db04889aa21..de206ac2b81 100644 --- a/TAO/orbsvcs/orbsvcs/Event/Event_Channel.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/Event_Channel.cpp @@ -88,7 +88,8 @@ ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_Event_Channel_Timeprobe_Description, // ************************************************************ static RtecScheduler::Preemption_Priority_t -Preemption_Priority (RtecScheduler::handle_t rtinfo, +Preemption_Priority (RtecScheduler::Scheduler_ptr scheduler, + RtecScheduler::handle_t rtinfo, CORBA::Environment &TAO_IN_ENV) { RtecScheduler::OS_Priority thread_priority; @@ -96,12 +97,22 @@ Preemption_Priority (RtecScheduler::handle_t rtinfo, RtecScheduler::Preemption_Priority_t preemption_priority; ACE_TIMEPROBE (TAO_EVENT_CHANNEL_PREEMPTION_PRIORITY_PRIORITY_REQUESTED); + +#if 1 + scheduler->priority + (rtinfo, + thread_priority, + subpriority, + preemption_priority, + TAO_IN_ENV); +#else ACE_Scheduler_Factory::server ()->priority (rtinfo, thread_priority, subpriority, preemption_priority, TAO_IN_ENV); +#endif TAO_CHECK_ENV_RETURN (TAO_IN_ENV, 0); return preemption_priority; } @@ -137,7 +148,8 @@ public: // When executed, tells <consumer_module> that <consumer> has shut // down. Shutdown_Consumer (ACE_ES_Consumer_Module *consumer_module, - ACE_Push_Consumer_Proxy *consumer) + ACE_Push_Consumer_Proxy *consumer, + RtecScheduler::Scheduler_ptr scheduler) : consumer_module_ (consumer_module) { consumer_ = consumer; @@ -159,7 +171,7 @@ public: { env.clear (); RtecScheduler::Preemption_Priority_t q = - ::Preemption_Priority ((*iter).rt_info, env); + ::Preemption_Priority (scheduler, (*iter).rt_info, env); if (env.exception () != 0) continue; if (rt_info_ == 0 || q < p) @@ -396,9 +408,7 @@ ACE_Push_Consumer_Proxy::push (const RtecEventComm::EventSet &events, if (CORBA::is_nil (push_consumer_.in ())) { ACE_DEBUG ((LM_DEBUG, - "EC (%t) Push to disconnected consumer %s\n", - ::ACE_ES_Consumer_Name (this->qos (), - TAO_IN_ENV))); + "EC (%t) Push to disconnected consumer\n")); // ACE_ES_DEBUG_ST (::dump_sequence (events)); return; } @@ -470,7 +480,8 @@ ACE_Push_Consumer_Proxy::shutdown (void) ACE_EventChannel::ACE_EventChannel (CORBA::Boolean activate_threads, u_long type, - TAO_Module_Factory* factory) + TAO_Module_Factory* factory, + RtecScheduler::Scheduler_ptr scheduler) : rtu_manager_ (0), type_ (type), state_ (INITIAL_STATE), @@ -484,6 +495,16 @@ ACE_EventChannel::ACE_EventChannel (CORBA::Boolean activate_threads, this->own_factory_ = 1; ACE_NEW (this->module_factory_, TAO_Default_Module_Factory); } + if (CORBA::is_nil (scheduler)) + { + this->scheduler_ = + RtecScheduler::Scheduler::_duplicate (ACE_Scheduler_Factory::server ()); + } + else + { + this->scheduler_ = + RtecScheduler::Scheduler::_duplicate (scheduler); + } consumer_module_ = this->module_factory_->create_consumer_module (this); @@ -1231,7 +1252,10 @@ ACE_ES_Consumer_Module::disconnecting (ACE_Push_Consumer_Proxy *consumer, // Create a shutdown message. When this is dispatched, it will // delete the proxy. - Shutdown_Consumer *sc = new Shutdown_Consumer (this, consumer); + RtecScheduler::Scheduler_var scheduler = + this->channel_->scheduler (); + Shutdown_Consumer *sc = + new Shutdown_Consumer (this, consumer, scheduler.in ()); if (sc == 0) TAO_THROW (CORBA::NO_MEMORY (CORBA::COMPLETED_NO)); @@ -2151,6 +2175,7 @@ ACE_ES_Subscription_Module::ACE_ES_Subscription_Module (ACE_EventChannel *channe up_ (0), down_ (0) { + this->scheduler_ = this->channel_->scheduler (); } void @@ -2245,15 +2270,22 @@ ACE_ES_Subscription_Module::connected (ACE_Push_Supplier_Proxy *supplier, // new subscribers list. Dependencies are updated. // @@ TODO: Handle exceptions. +#if 1 + this->scheduler_->add_dependency + ((*proxy)->dependency()->rt_info, + new_subscribers->dependency_info_->rt_info, + new_subscribers->dependency_info_->number_of_calls, + RtecScheduler::ONE_WAY_CALL, + TAO_IN_ENV); +#else ACE_Scheduler_Factory::server()->add_dependency ((*proxy)->dependency()->rt_info, new_subscribers->dependency_info_->rt_info, new_subscribers->dependency_info_->number_of_calls, RtecScheduler::ONE_WAY_CALL, TAO_IN_ENV); - if (TAO_IN_ENV.exception () != 0) - return; - // @@ TODO use the TAO_TRY macros. +#endif + TAO_CHECK_ENV_RETURN_VOID (TAO_IN_ENV); if (new_subscribers->consumers_.insert (*proxy) == -1) { @@ -2617,12 +2649,21 @@ ACE_ES_Subscription_Module::subscribe_source (ACE_ES_Consumer_Rep *consumer, { TAO_TRY { +#if 1 + this->scheduler_->add_dependency + (consumer->dependency()->rt_info, + temp->int_id_->dependency_info_->rt_info, + temp->int_id_->dependency_info_->number_of_calls, + RtecScheduler::ONE_WAY_CALL, + TAO_TRY_ENV); +#else ACE_Scheduler_Factory::server()->add_dependency (consumer->dependency()->rt_info, temp->int_id_->dependency_info_->rt_info, temp->int_id_->dependency_info_->number_of_calls, RtecScheduler::ONE_WAY_CALL, TAO_TRY_ENV); +#endif TAO_CHECK_ENV; } TAO_CATCHANY @@ -2682,12 +2723,21 @@ ACE_ES_Subscription_Module::subscribe_type (ACE_ES_Consumer_Rep *consumer, // @@ TODO handle exceptions. TAO_TRY { +#if 1 + this->scheduler_->add_dependency + (consumer->dependency ()->rt_info, + dependency_info->rt_info, + dependency_info->number_of_calls, + RtecScheduler::ONE_WAY_CALL, + TAO_TRY_ENV); +#else ACE_Scheduler_Factory::server()->add_dependency (consumer->dependency ()->rt_info, dependency_info->rt_info, dependency_info->number_of_calls, RtecScheduler::ONE_WAY_CALL, TAO_TRY_ENV); +#endif TAO_CHECK_ENV; } TAO_CATCHANY @@ -2742,12 +2792,21 @@ ACE_ES_Subscription_Module::subscribe_source_type (ACE_ES_Consumer_Rep *consumer // @@ TODO handle exceptions. TAO_TRY { +#if 1 + this->scheduler_->add_dependency + (consumer->dependency ()->rt_info, + dependency_info->rt_info, + dependency_info->number_of_calls, + RtecScheduler::ONE_WAY_CALL, + TAO_TRY_ENV); +#else ACE_Scheduler_Factory::server()->add_dependency (consumer->dependency ()->rt_info, dependency_info->rt_info, dependency_info->number_of_calls, RtecScheduler::ONE_WAY_CALL, TAO_TRY_ENV); +#endif TAO_CHECK_ENV; } TAO_CATCHANY @@ -3244,28 +3303,6 @@ ACE_ES_Supplier_Module::fill_qos (RtecEventChannelAdmin::SupplierQOS& s_qos) // ************************************************************ -const char * -ACE_ES_Consumer_Name (const RtecEventChannelAdmin::ConsumerQOS &qos, - CORBA::Environment &TAO_IN_ENV) -{ - // The first dependency should designate a correlation group. - - ACE_FUNCTION_TIMEPROBE (TAO_EVENT_CHANNEL_CONSUMER_NAME_PRIORITY_REQUESTED); - if (qos.dependencies.length () <= 1) - return "no-name"; - - RtecScheduler::RT_Info* rt_info = ACE_Scheduler_Factory::server ()->get - (qos.dependencies[1].rt_info, TAO_IN_ENV); - TAO_CHECK_ENV_RETURN (TAO_IN_ENV, 0); - - if (rt_info == 0) - return "no-name"; - - return rt_info->entry_point; -} - -// ************************************************************ - #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Atomic_Op<ACE_ES_MUTEX, int>; diff --git a/TAO/orbsvcs/orbsvcs/Event/Event_Channel.h b/TAO/orbsvcs/orbsvcs/Event/Event_Channel.h index adbc3354e09..2de6ec418e6 100644 --- a/TAO/orbsvcs/orbsvcs/Event/Event_Channel.h +++ b/TAO/orbsvcs/orbsvcs/Event/Event_Channel.h @@ -100,14 +100,6 @@ void TAO_ORBSVCS_Export dump_event (const RtecEventComm::Event &event); // ************************************************************ -// Helper function that returns the first RT_Info entry point name. -// Use for debugging purposes only. -const TAO_ORBSVCS_Export char * -ACE_ES_Consumer_Name (const RtecEventChannelAdmin::ConsumerQOS &qos, - CORBA::Environment &_env); - -// ************************************************************ - class TAO_ORBSVCS_Export ACE_RTU_Manager // = TITLE // ACE RTU Manager @@ -183,7 +175,9 @@ public: ACE_EventChannel (CORBA::Boolean activate_threads = 1, u_long type = ACE_DEFAULT_EVENT_CHANNEL_TYPE, - TAO_Module_Factory* factory = 0); + TAO_Module_Factory* factory = 0, + RtecScheduler::Scheduler_ptr scheduler = + RtecScheduler::Scheduler::_nil ()); // Construction of the given <type>. Check the **_CHANNEL // enumerations defined below. // By default we activate the threads on construction, but it is @@ -274,6 +268,11 @@ public: // Timer_ACT used when scheduling the timer. Returns 0 on success, // -1 on failure. + RtecScheduler::Scheduler_ptr scheduler (void); + // Return a reference to its SchedulerService, notice that it uses + // the CORBA semantics for memory managment, i.e. the user gains + // ownership of the reference returned. + private: void cleanup_observers (void); // Remove all the observers, this simplifies the shutdown process. @@ -339,6 +338,9 @@ private: TAO_Module_Factory* module_factory_; // This is the factory we use to create and destroy the Event // Channel modules. + + RtecScheduler::Scheduler_var scheduler_; + // The scheduler }; // ************************************************************ @@ -1161,6 +1163,9 @@ private: ACE_ES_RW_LOCK lock_; // Protects access to all_suppliers_ and type_suppliers_; + + RtecScheduler::Scheduler_ptr scheduler_; + // The scheduler; }; // ************************************************************ diff --git a/TAO/orbsvcs/orbsvcs/Event/Event_Channel.i b/TAO/orbsvcs/orbsvcs/Event/Event_Channel.i index 710add82135..ae9c1904ea6 100644 --- a/TAO/orbsvcs/orbsvcs/Event/Event_Channel.i +++ b/TAO/orbsvcs/orbsvcs/Event/Event_Channel.i @@ -698,12 +698,20 @@ ACE_EventChannel::schedule_timer (RtecScheduler::handle_t rt_info, TAO_TRY { +#if 1 + this->scheduler_->add_dependency (rt_info, + timer_rtinfo, + 1, + RtecScheduler::ONE_WAY_CALL, + TAO_TRY_ENV); +#else ACE_Scheduler_Factory::server()->add_dependency (rt_info, timer_rtinfo, 1, RtecScheduler::ONE_WAY_CALL, TAO_TRY_ENV); +#endif TAO_CHECK_ENV; } TAO_CATCHANY @@ -736,5 +744,11 @@ ACE_EventChannel::cancel_timer (RtecScheduler::OS_Priority preemption_priority, act); } +ACE_INLINE RtecScheduler::Scheduler_ptr +ACE_EventChannel::scheduler (void) +{ + return RtecScheduler::Scheduler::_duplicate (this->scheduler_.in ()); +} + // ************************************************************ diff --git a/TAO/orbsvcs/orbsvcs/Event/Module_Factory.cpp b/TAO/orbsvcs/orbsvcs/Event/Module_Factory.cpp index 763b40f65c6..62e604203dc 100644 --- a/TAO/orbsvcs/orbsvcs/Event/Module_Factory.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/Module_Factory.cpp @@ -24,7 +24,7 @@ TAO_Default_Module_Factory::~TAO_Default_Module_Factory (void) ACE_ES_Dispatching_Base* TAO_Default_Module_Factory::create_dispatching_module (ACE_EventChannel* ec) { - return new ACE_ES_Priority_Dispatching(ec); + return new ACE_ES_Priority_Dispatching (ec); } void @@ -84,7 +84,8 @@ TAO_Default_Module_Factory::destroy_supplier_module (ACE_ES_Supplier_Module* x) TAO_EC_Timer_Module* TAO_Default_Module_Factory::create_timer_module (ACE_EventChannel* ec) { - return new TAO_EC_RPT_Timer_Module; + RtecScheduler::Scheduler_var scheduler = ec->scheduler (); + return new TAO_EC_RPT_Timer_Module (scheduler.in ()); } void @@ -164,7 +165,7 @@ TAO_Reactive_Module_Factory::destroy_supplier_module (ACE_ES_Supplier_Module* x) } TAO_EC_Timer_Module* -TAO_Reactive_Module_Factory::create_timer_module (ACE_EventChannel*) +TAO_Reactive_Module_Factory::create_timer_module (ACE_EventChannel* ec) { return new TAO_EC_ST_Timer_Module (TAO_ORB_Core_instance ()->reactor ()); } diff --git a/TAO/orbsvcs/orbsvcs/Event/RT_Task.cpp b/TAO/orbsvcs/orbsvcs/Event/RT_Task.cpp index d6d0b57a7b5..6289676a0a5 100644 --- a/TAO/orbsvcs/orbsvcs/Event/RT_Task.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/RT_Task.cpp @@ -72,11 +72,20 @@ ACE_RT_Task_Shutdown::execute (u_long &command_action) } // ************************************************************ -// ************************************************************ -ACE_RT_Task::ACE_RT_Task (void) +ACE_RT_Task::ACE_RT_Task (RtecScheduler::Scheduler_ptr scheduler) : closed_ (0) { + if (CORBA::is_nil (scheduler)) + { + this->scheduler_ = + RtecScheduler::Scheduler::_duplicate (ACE_Scheduler_Factory::server ()); + } + else + { + this->scheduler_ = + RtecScheduler::Scheduler::_duplicate (scheduler); + } } ACE_RT_Task::~ACE_RT_Task (void) @@ -106,11 +115,19 @@ ACE_RT_Task::svc (void) RtecScheduler::Preemption_Subpriority_t subpriority; RtecScheduler::Preemption_Priority_t preemption_priority; +#if 1 + this->scheduler_->priority + (this->rt_info_, + thread_priority, + subpriority, + preemption_priority, TAO_TRY_ENV); +#else ACE_Scheduler_Factory::server ()->priority (this->rt_info_, thread_priority, subpriority, preemption_priority, TAO_TRY_ENV); +#endif TAO_CHECK_ENV; if (ACE_OS::thr_setprio (thread_priority) == -1) { @@ -240,9 +257,14 @@ ACE_RT_Task::open_task (const char* name) TAO_TRY { +#if 1 + rt_info_ = + this->scheduler_->create (tempname, TAO_TRY_ENV); +#else rt_info_ = ACE_Scheduler_Factory::server()->create (tempname, TAO_TRY_ENV); +#endif TAO_CHECK_ENV; // @@ TODO: We do no initialization of the new rt_info, the // caller does, this is (IMnsHO) very error prone. @@ -293,11 +315,19 @@ ACE_RT_Task::synch_threads (size_t threads) { // @@ TODO handle exceptions ACE_FUNCTION_TIMEPROBE (TAO_RT_TASK_SYNCH_THREADS_PRIORITY_REQUESTED); +#if 1 + this->scheduler_->priority + (rt_info_, + thread_priority, + subpriority, + preemption_priority, TAO_TRY_ENV); +#else ACE_Scheduler_Factory::server ()->priority (rt_info_, thread_priority, subpriority, preemption_priority, TAO_TRY_ENV); +#endif TAO_CHECK_ENV; } diff --git a/TAO/orbsvcs/orbsvcs/Event/RT_Task.h b/TAO/orbsvcs/orbsvcs/Event/RT_Task.h index be8fc01ff9e..2a847fb2a93 100644 --- a/TAO/orbsvcs/orbsvcs/Event/RT_Task.h +++ b/TAO/orbsvcs/orbsvcs/Event/RT_Task.h @@ -101,7 +101,8 @@ class TAO_ORBSVCS_Export ACE_RT_Task : public ACE_ES_TASK // one thread should be calling any management methods. friend class ACE_RT_Thread_Manager; public: - ACE_RT_Task (void); + ACE_RT_Task (RtecScheduler::Scheduler_ptr scheduler = + RtecScheduler::Scheduler::_nil ()); // Default construction. ~ACE_RT_Task (void); @@ -155,13 +156,6 @@ public: // of command->execute (). protected: - RtecScheduler::handle_t rt_info_; - // Scheduling characteristics of this active object. - - int closed_; - // Set to 1 when this->shutdown_threads or this->close_queue is - // called. Keeps us from enqueuing more that one shutdown message. - virtual int svc (void); // Run by each thread spawned. Each thread dequeues // ACE_RT_Task_Commands and executes them. @@ -171,6 +165,17 @@ protected: void close_all_threads (void); // Enqueues shutdown message for every thread in the task. + +protected: + RtecScheduler::handle_t rt_info_; + // Scheduling characteristics of this active object. + + int closed_; + // Set to 1 when this->shutdown_threads or this->close_queue is + // called. Keeps us from enqueuing more that one shutdown message. + + RtecScheduler::Scheduler_var scheduler_; + // The scheduler. }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Event/ReactorTask.cpp b/TAO/orbsvcs/orbsvcs/Event/ReactorTask.cpp index dfe0b8ae02e..2fcf5663853 100644 --- a/TAO/orbsvcs/orbsvcs/Event/ReactorTask.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/ReactorTask.cpp @@ -29,9 +29,11 @@ ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_Reactor_Task_Timeprobe_Description, #endif /* ACE_ENABLE_TIMEPROBES */ -ACE_ES_Reactor_Task::ACE_ES_Reactor_Task() : - // reactor_ (0, &timer_queue_), - done_ (0) +ACE_ES_Reactor_Task:: + ACE_ES_Reactor_Task (RtecScheduler::Scheduler_ptr scheduler) + : ACE_RT_Task (scheduler), + // reactor_ (0, &timer_queue_), + done_ (0) { // Change the timer mechanism used by the reactor and the timer // queue. @@ -75,17 +77,33 @@ ACE_ES_Reactor_Task::open_reactor (RtecScheduler::Period_t &period) { TAO_TRY { - ACE_Scheduler_Factory::server()->set(rt_info_, - RtecScheduler::VERY_HIGH_CRITICALITY, - ORBSVCS_Time::zero, - ORBSVCS_Time::zero, - ORBSVCS_Time::zero, - period, - RtecScheduler::VERY_LOW_IMPORTANCE, - ORBSVCS_Time::zero, - 1, - RtecScheduler::OPERATION, - TAO_TRY_ENV); +#if 1 + this->scheduler_->set + (rt_info_, + RtecScheduler::VERY_HIGH_CRITICALITY, + ORBSVCS_Time::zero, + ORBSVCS_Time::zero, + ORBSVCS_Time::zero, + period, + RtecScheduler::VERY_LOW_IMPORTANCE, + ORBSVCS_Time::zero, + 1, + RtecScheduler::OPERATION, + TAO_TRY_ENV); +#else + ACE_Scheduler_Factory::server()->set + (rt_info_, + RtecScheduler::VERY_HIGH_CRITICALITY, + ORBSVCS_Time::zero, + ORBSVCS_Time::zero, + ORBSVCS_Time::zero, + period, + RtecScheduler::VERY_LOW_IMPORTANCE, + ORBSVCS_Time::zero, + 1, + RtecScheduler::OPERATION, + TAO_TRY_ENV); +#endif TAO_CHECK_ENV; } TAO_CATCHANY diff --git a/TAO/orbsvcs/orbsvcs/Event/ReactorTask.h b/TAO/orbsvcs/orbsvcs/Event/ReactorTask.h index d36eafc72f3..8bbdc0b29a3 100644 --- a/TAO/orbsvcs/orbsvcs/Event/ReactorTask.h +++ b/TAO/orbsvcs/orbsvcs/Event/ReactorTask.h @@ -38,10 +38,11 @@ public: typedef ACE_Reactor Reactor; #endif /* ACE_OLD_STYLE_REACTOR */ - ACE_ES_Reactor_Task(); + ACE_ES_Reactor_Task (RtecScheduler::Scheduler_ptr scheduler = + RtecScheduler::Scheduler::_nil ()); // Default construction. - ~ACE_ES_Reactor_Task(); + ~ACE_ES_Reactor_Task (void); // Destruction. virtual int svc_hook(RtecScheduler::OS_Priority); diff --git a/TAO/orbsvcs/orbsvcs/Event/Timer_Module.cpp b/TAO/orbsvcs/orbsvcs/Event/Timer_Module.cpp index 3946da1f459..45cd920e38a 100644 --- a/TAO/orbsvcs/orbsvcs/Event/Timer_Module.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/Timer_Module.cpp @@ -2,8 +2,9 @@ #include "ace/Functor.h" -#include "orbsvcs/orbsvcs/Event/ReactorTask.h" -#include "orbsvcs/orbsvcs/Event/Timer_Module.h" +#include "orbsvcs/Scheduler_Factory.h" +#include "ReactorTask.h" +#include "Timer_Module.h" #if ! defined (__ACE_INLINE__) #include "Timer_Module.i" @@ -117,9 +118,20 @@ TAO_EC_ST_Timer_Module::reactor (RtecScheduler::Preemption_Priority_t) // **************************************************************** -TAO_EC_RPT_Timer_Module::TAO_EC_RPT_Timer_Module (void) +TAO_EC_RPT_Timer_Module:: + TAO_EC_RPT_Timer_Module (RtecScheduler::Scheduler_ptr scheduler) : shutdown_ (0) { + if (CORBA::is_nil (scheduler)) + { + this->scheduler_ = + RtecScheduler::Scheduler::_duplicate (ACE_Scheduler_Factory::server ()); + } + else + { + this->scheduler_ = + RtecScheduler::Scheduler::_duplicate (scheduler); + } for (int i = 0; i < ACE_Scheduler_MAX_PRIORITIES; ++i) this->reactorTasks[i] = 0; } @@ -153,7 +165,8 @@ void TAO_EC_RPT_Timer_Module::activate (void) RtecScheduler::Period_t period = period_tv.sec () * 10000000 + period_tv.usec () * 10; - ACE_NEW (this->reactorTasks[i], ReactorTask); + ACE_NEW (this->reactorTasks[i], + ReactorTask (this->scheduler_.in ())); if (!this->shutdown_) { diff --git a/TAO/orbsvcs/orbsvcs/Event/Timer_Module.h b/TAO/orbsvcs/orbsvcs/Event/Timer_Module.h index 7f0102ea06d..f667e24cf4c 100644 --- a/TAO/orbsvcs/orbsvcs/Event/Timer_Module.h +++ b/TAO/orbsvcs/orbsvcs/Event/Timer_Module.h @@ -149,7 +149,8 @@ class TAO_ORBSVCS_Export TAO_EC_RPT_Timer_Module : public TAO_EC_Timer_Module // each Reactor runs at a different priority. // public: - TAO_EC_RPT_Timer_Module (void); + TAO_EC_RPT_Timer_Module (RtecScheduler::Scheduler_ptr scheduler = + RtecScheduler::Scheduler::_nil ()); // Create the Timer Module virtual ~TAO_EC_RPT_Timer_Module (void); @@ -193,6 +194,9 @@ private: TAO_EC_Timeout_Handler timeout_handler_; // To receive the timeouts. + + RtecScheduler::Scheduler_var scheduler_; + // The scheduler. }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/tests/EC_Basic/EC_Basic.cpp b/TAO/orbsvcs/tests/EC_Basic/EC_Basic.cpp index 0f8a136d6ca..3e5b8debb1b 100644 --- a/TAO/orbsvcs/tests/EC_Basic/EC_Basic.cpp +++ b/TAO/orbsvcs/tests/EC_Basic/EC_Basic.cpp @@ -6,7 +6,6 @@ #include "orbsvcs/Event_Utilities.h" #include "orbsvcs/Event_Service_Constants.h" -#include "orbsvcs/Scheduler_Factory.h" #include "orbsvcs/Time_Utilities.h" #include "orbsvcs/RtecEventChannelAdminC.h" #include "orbsvcs/Sched/Config_Scheduler.h" @@ -99,15 +98,13 @@ ECB_Driver::run (int argc, char* argv[]) "EC_Basic: The (local) scheduler IOR is <%s>\n", str.in ())); - if (ACE_Scheduler_Factory::server (scheduler.in ()) == -1) - return -1; - // Create the EventService implementation, but don't start its // internal threads. TAO_Reactive_Module_Factory module_factory; ACE_EventChannel ec_impl (0, ACE_DEFAULT_EVENT_CHANNEL_TYPE, - &module_factory); + &module_factory, + scheduler.in ()); // Register Event_Service with the Naming Service. RtecEventChannelAdmin::EventChannel_var ec = @@ -434,7 +431,7 @@ ECB_SupplierID_Test::run (CORBA::ORB_ptr orb, int i; - for (i = 0; i < ECB_SupplierID_Test::PHASE_END; ++i) + for (i = 0; i <= ECB_SupplierID_Test::PHASE_END; ++i) { this->event_count_[i] = 0; this->error_count_[i] = 0; @@ -772,7 +769,7 @@ ECB_Correlation_Test::run (CORBA::ORB_ptr orb, int i; - for (i = 0; i < ECB_Correlation_Test::PHASE_END; ++i) + for (i = 0; i <= ECB_Correlation_Test::PHASE_END; ++i) { this->event_count_[i] = 0; this->error_count_[i] = 0; diff --git a/TAO/orbsvcs/tests/EC_Throughput/ECT_Consumer.cpp b/TAO/orbsvcs/tests/EC_Throughput/ECT_Consumer.cpp index 42011321d60..dfac0802a25 100644 --- a/TAO/orbsvcs/tests/EC_Throughput/ECT_Consumer.cpp +++ b/TAO/orbsvcs/tests/EC_Throughput/ECT_Consumer.cpp @@ -7,7 +7,6 @@ #include "tao/Timeprobe.h" #include "orbsvcs/Event_Utilities.h" #include "orbsvcs/Event_Service_Constants.h" -#include "orbsvcs/Scheduler_Factory.h" #include "orbsvcs/Time_Utilities.h" #include "ECT_Consumer.h" @@ -25,16 +24,14 @@ Test_Consumer::Test_Consumer (ECT_Driver *driver, } void -Test_Consumer::connect (const char* name, +Test_Consumer::connect (RtecScheduler::Scheduler_ptr scheduler, + const char* name, int event_a, int event_b, RtecEventChannelAdmin::EventChannel_ptr ec, CORBA::Environment& TAO_IN_ENV) { - RtecScheduler::Scheduler_ptr server = - ACE_Scheduler_Factory::server (); - RtecScheduler::handle_t rt_info = - server->create (name, TAO_IN_ENV); + scheduler->create (name, TAO_IN_ENV); TAO_CHECK_ENV_RETURN_VOID (TAO_IN_ENV); // The worst case execution time is far less than 2 @@ -42,15 +39,15 @@ Test_Consumer::connect (const char* name, ACE_Time_Value tv (0, 2000); TimeBase::TimeT time; ORBSVCS_Time::Time_Value_to_TimeT (time, tv); - server->set (rt_info, - RtecScheduler::VERY_HIGH_CRITICALITY, - time, time, time, - 0, - RtecScheduler::VERY_LOW_IMPORTANCE, - time, - 0, - RtecScheduler::OPERATION, - TAO_IN_ENV); + scheduler->set (rt_info, + RtecScheduler::VERY_HIGH_CRITICALITY, + time, time, time, + 0, + RtecScheduler::VERY_LOW_IMPORTANCE, + time, + 0, + RtecScheduler::OPERATION, + TAO_IN_ENV); TAO_CHECK_ENV_RETURN_VOID (TAO_IN_ENV); ACE_ConsumerQOS_Factory qos; diff --git a/TAO/orbsvcs/tests/EC_Throughput/ECT_Consumer.h b/TAO/orbsvcs/tests/EC_Throughput/ECT_Consumer.h index f4d0b13d97c..c59cee0a4dd 100644 --- a/TAO/orbsvcs/tests/EC_Throughput/ECT_Consumer.h +++ b/TAO/orbsvcs/tests/EC_Throughput/ECT_Consumer.h @@ -36,7 +36,8 @@ public: void* cookie, int n_suppliers); - void connect (const char* name, + void connect (RtecScheduler::Scheduler_ptr scheduler, + const char* name, int event_a, int event_b, RtecEventChannelAdmin::EventChannel_ptr ec, diff --git a/TAO/orbsvcs/tests/EC_Throughput/ECT_Consumer_Driver.cpp b/TAO/orbsvcs/tests/EC_Throughput/ECT_Consumer_Driver.cpp index 486b2824388..b8e68020b14 100644 --- a/TAO/orbsvcs/tests/EC_Throughput/ECT_Consumer_Driver.cpp +++ b/TAO/orbsvcs/tests/EC_Throughput/ECT_Consumer_Driver.cpp @@ -5,9 +5,9 @@ #include "ace/Sched_Params.h" #include "tao/Timeprobe.h" +#include "orbsvcs/CosNamingC.h" #include "orbsvcs/Event_Utilities.h" #include "orbsvcs/Event_Service_Constants.h" -#include "orbsvcs/Scheduler_Factory.h" #include "orbsvcs/Time_Utilities.h" #include "ECT_Consumer_Driver.h" @@ -122,8 +122,19 @@ ECT_Consumer_Driver::run (int argc, char* argv[]) CosNaming::NamingContext::_narrow (naming_obj.in (), TAO_TRY_ENV); TAO_CHECK_ENV; - if (ACE_Scheduler_Factory::use_config (naming_context.in ()) == -1) - return -1; + CosNaming::Name schedule_name (1); + schedule_name.length (1); + schedule_name[0].id = CORBA::string_dup ("ScheduleService"); + + CORBA::Object_var sched_obj = + naming_context->resolve (schedule_name, TAO_TRY_ENV); + TAO_CHECK_ENV; + if (CORBA::is_nil (sched_obj.in ())) + return 1; + RtecScheduler::Scheduler_var scheduler = + RtecScheduler::Scheduler::_narrow (sched_obj.in (), + TAO_TRY_ENV); + TAO_CHECK_ENV; CosNaming::Name name (1); name.length (1); @@ -144,7 +155,7 @@ ECT_Consumer_Driver::run (int argc, char* argv[]) poa_manager->activate (TAO_TRY_ENV); TAO_CHECK_ENV; - this->connect_consumers (channel.in (), TAO_TRY_ENV); + this->connect_consumers (scheduler.in (), channel.in (), TAO_TRY_ENV); TAO_CHECK_ENV; ACE_DEBUG ((LM_DEBUG, "connected consumer(s)\n")); @@ -191,8 +202,10 @@ ECT_Consumer_Driver::shutdown_consumer (void*, } void -ECT_Consumer_Driver::connect_consumers (RtecEventChannelAdmin::EventChannel_ptr channel, - CORBA::Environment &TAO_IN_ENV) +ECT_Consumer_Driver::connect_consumers + (RtecScheduler::Scheduler_ptr scheduler, + RtecEventChannelAdmin::EventChannel_ptr channel, + CORBA::Environment &TAO_IN_ENV) { { ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->lock_); @@ -208,7 +221,8 @@ ECT_Consumer_Driver::connect_consumers (RtecEventChannelAdmin::EventChannel_ptr this->consumers_ + i, this->n_suppliers_)); - this->consumers_[i]->connect (buf, + this->consumers_[i]->connect (scheduler, + buf, this->event_a_, this->event_b_, channel, diff --git a/TAO/orbsvcs/tests/EC_Throughput/ECT_Consumer_Driver.h b/TAO/orbsvcs/tests/EC_Throughput/ECT_Consumer_Driver.h index ddd20cee0ae..36827c86218 100644 --- a/TAO/orbsvcs/tests/EC_Throughput/ECT_Consumer_Driver.h +++ b/TAO/orbsvcs/tests/EC_Throughput/ECT_Consumer_Driver.h @@ -53,7 +53,8 @@ private: int parse_args (int argc, char* argv[]); // parse the command line args - void connect_consumers (RtecEventChannelAdmin::EventChannel_ptr local_ec, + void connect_consumers (RtecScheduler::Scheduler_ptr scheduler, + RtecEventChannelAdmin::EventChannel_ptr local_ec, CORBA::Environment &_env); void disconnect_consumers (CORBA::Environment &_env); // Connect and disconnect the consumers. diff --git a/TAO/orbsvcs/tests/EC_Throughput/ECT_Supplier.cpp b/TAO/orbsvcs/tests/EC_Throughput/ECT_Supplier.cpp index 6a64d5aa091..f98fb2cf5f8 100644 --- a/TAO/orbsvcs/tests/EC_Throughput/ECT_Supplier.cpp +++ b/TAO/orbsvcs/tests/EC_Throughput/ECT_Supplier.cpp @@ -7,7 +7,6 @@ #include "tao/Timeprobe.h" #include "orbsvcs/Event_Utilities.h" #include "orbsvcs/Event_Service_Constants.h" -#include "orbsvcs/Scheduler_Factory.h" #include "orbsvcs/Time_Utilities.h" #include "ECT_Supplier.h" @@ -24,7 +23,8 @@ Test_Supplier::Test_Supplier (ECT_Driver *driver) } void -Test_Supplier::connect (const char* name, +Test_Supplier::connect (RtecScheduler::Scheduler_ptr scheduler, + const char* name, int burst_count, int burst_size, int event_size, @@ -41,11 +41,8 @@ Test_Supplier::connect (const char* name, this->event_a_ = event_a; this->event_b_ = event_b; - RtecScheduler::Scheduler_ptr server = - ACE_Scheduler_Factory::server (); - RtecScheduler::handle_t rt_info = - server->create (name, TAO_IN_ENV); + scheduler->create (name, TAO_IN_ENV); TAO_CHECK_ENV_RETURN_VOID (TAO_IN_ENV); ACE_Time_Value tv (0, burst_pause); @@ -58,15 +55,15 @@ Test_Supplier::connect (const char* name, tv.set (0, 2000); TimeBase::TimeT time; ORBSVCS_Time::Time_Value_to_TimeT (time, tv); - server->set (rt_info, - RtecScheduler::VERY_HIGH_CRITICALITY, - time, time, time, - rate, - RtecScheduler::VERY_LOW_IMPORTANCE, - time, - 1, - RtecScheduler::OPERATION, - TAO_IN_ENV); + scheduler->set (rt_info, + RtecScheduler::VERY_HIGH_CRITICALITY, + time, time, time, + rate, + RtecScheduler::VERY_LOW_IMPORTANCE, + time, + 1, + RtecScheduler::OPERATION, + TAO_IN_ENV); TAO_CHECK_ENV_RETURN_VOID (TAO_IN_ENV); this->supplier_id_ = ACE::crc32 (name); diff --git a/TAO/orbsvcs/tests/EC_Throughput/ECT_Supplier.h b/TAO/orbsvcs/tests/EC_Throughput/ECT_Supplier.h index 67e6355cf66..a694b13fb2e 100644 --- a/TAO/orbsvcs/tests/EC_Throughput/ECT_Supplier.h +++ b/TAO/orbsvcs/tests/EC_Throughput/ECT_Supplier.h @@ -37,7 +37,8 @@ public: int svc (void); // Run the test, just forwards to the driver - void connect (const char* name, + void connect (RtecScheduler::Scheduler_ptr scheduler, + const char* name, int burst_count, int burst_size, int event_size, diff --git a/TAO/orbsvcs/tests/EC_Throughput/ECT_Supplier_Driver.cpp b/TAO/orbsvcs/tests/EC_Throughput/ECT_Supplier_Driver.cpp index 10c62b4d764..7444b067e0b 100644 --- a/TAO/orbsvcs/tests/EC_Throughput/ECT_Supplier_Driver.cpp +++ b/TAO/orbsvcs/tests/EC_Throughput/ECT_Supplier_Driver.cpp @@ -5,9 +5,9 @@ #include "ace/Sched_Params.h" #include "tao/Timeprobe.h" +#include "orbsvcs/CosNamingC.h" #include "orbsvcs/Event_Utilities.h" #include "orbsvcs/Event_Service_Constants.h" -#include "orbsvcs/Scheduler_Factory.h" #include "orbsvcs/Time_Utilities.h" #include "ECT_Supplier_Driver.h" @@ -136,9 +136,19 @@ ECT_Supplier_Driver::run (int argc, char* argv[]) CosNaming::NamingContext::_narrow (naming_obj.in (), TAO_TRY_ENV); TAO_CHECK_ENV; - if (ACE_Scheduler_Factory::use_config (naming_context.in ()) == -1) - return -1; + CosNaming::Name schedule_name (1); + schedule_name.length (1); + schedule_name[0].id = CORBA::string_dup ("ScheduleService"); + CORBA::Object_var sched_obj = + naming_context->resolve (schedule_name, TAO_TRY_ENV); + TAO_CHECK_ENV; + if (CORBA::is_nil (sched_obj.in ())) + return 1; + RtecScheduler::Scheduler_var scheduler = + RtecScheduler::Scheduler::_narrow (sched_obj.in (), + TAO_TRY_ENV); + TAO_CHECK_ENV; CosNaming::Name name (1); name.length (1); name[0].id = CORBA::string_dup ("EventService"); @@ -158,7 +168,9 @@ ECT_Supplier_Driver::run (int argc, char* argv[]) poa_manager->activate (TAO_TRY_ENV); TAO_CHECK_ENV; - this->connect_suppliers (channel.in (), TAO_TRY_ENV); + this->connect_suppliers (scheduler.in (), + channel.in (), + TAO_TRY_ENV); TAO_CHECK_ENV; ACE_DEBUG ((LM_DEBUG, "connected supplier(s)\n")); @@ -197,8 +209,10 @@ ECT_Supplier_Driver::run (int argc, char* argv[]) } void -ECT_Supplier_Driver::connect_suppliers (RtecEventChannelAdmin::EventChannel_ptr channel, - CORBA::Environment &TAO_IN_ENV) +ECT_Supplier_Driver::connect_suppliers + (RtecScheduler::Scheduler_ptr scheduler, + RtecEventChannelAdmin::EventChannel_ptr channel, + CORBA::Environment &TAO_IN_ENV) { for (int i = 0; i < this->n_suppliers_; ++i) { @@ -207,7 +221,8 @@ ECT_Supplier_Driver::connect_suppliers (RtecEventChannelAdmin::EventChannel_ptr ACE_NEW (this->suppliers_[i], Test_Supplier (this)); - this->suppliers_[i]->connect (buf, + this->suppliers_[i]->connect (scheduler, + buf, this->burst_count_, this->burst_size_, this->event_size_, diff --git a/TAO/orbsvcs/tests/EC_Throughput/ECT_Supplier_Driver.h b/TAO/orbsvcs/tests/EC_Throughput/ECT_Supplier_Driver.h index 302be352cdb..7db63600626 100644 --- a/TAO/orbsvcs/tests/EC_Throughput/ECT_Supplier_Driver.h +++ b/TAO/orbsvcs/tests/EC_Throughput/ECT_Supplier_Driver.h @@ -51,7 +51,8 @@ private: int parse_args (int argc, char* argv[]); // parse the command line args - void connect_suppliers (RtecEventChannelAdmin::EventChannel_ptr local_ec, + void connect_suppliers (RtecScheduler::Scheduler_ptr scheduler, + RtecEventChannelAdmin::EventChannel_ptr local_ec, CORBA::Environment &_env); void disconnect_suppliers (CORBA::Environment &_env); // Connect the suppliers. diff --git a/TAO/orbsvcs/tests/EC_Throughput/ECT_Throughput.cpp b/TAO/orbsvcs/tests/EC_Throughput/ECT_Throughput.cpp index 5bc528d629a..fbb12064123 100644 --- a/TAO/orbsvcs/tests/EC_Throughput/ECT_Throughput.cpp +++ b/TAO/orbsvcs/tests/EC_Throughput/ECT_Throughput.cpp @@ -14,7 +14,7 @@ #include "orbsvcs/Event/Event_Channel.h" #include "orbsvcs/Event/Module_Factory.h" #include "orbsvcs/Event/EC_Event_Channel.h" -#include "orbsvcs/Event/EC_Null_Factory.h" +#include "orbsvcs/Event/EC_Basic_Factory.h" #include "ECT_Throughput.h" ACE_RCSID(EC_Throughput, ECT_Throughput, "$Id$") @@ -167,7 +167,7 @@ ECT_Throughput::run (int argc, char* argv[]) scheduler_impl._this (TAO_TRY_ENV); TAO_CHECK_ENV; - +#if 0 CORBA::String_var str = this->orb_->object_to_string (scheduler.in (), TAO_TRY_ENV); TAO_CHECK_ENV; @@ -179,6 +179,7 @@ ECT_Throughput::run (int argc, char* argv[]) TAO_CHECK_ENV; ACE_Scheduler_Factory::use_config (naming_context.in ()); +#endif /* 0 */ // The factories must be destroyed *after* the EC, hence the // auto_ptr declarations must go first.... @@ -205,13 +206,14 @@ ECT_Throughput::run (int argc, char* argv[]) auto_ptr<POA_RtecEventChannelAdmin::EventChannel> (new ACE_EventChannel (1, ACE_DEFAULT_EVENT_CHANNEL_TYPE, - module_factory.get ())); + module_factory.get (), + scheduler.in ())); } else { -#if 0 +#if defined (TAO_ORBSVCS_HAS_Event2) ec_factory = - auto_ptr<TAO_EC_Factory>(new TAO_EC_Null_Factory (root_poa.in ())); + auto_ptr<TAO_EC_Factory>(new TAO_EC_Basic_Factory (root_poa.in ())); TAO_EC_Event_Channel* ec = new TAO_EC_Event_Channel (ec_factory.get ()); @@ -224,7 +226,7 @@ ECT_Throughput::run (int argc, char* argv[]) ACE_ERROR_RETURN ((LM_ERROR, "The new event channel is not supported " "please recompile\n"), 1); -#endif /* 0 */ +#endif /* TAO_ORBSVCS_HAS_Event2 */ } RtecEventChannelAdmin::EventChannel_var channel = @@ -234,12 +236,14 @@ ECT_Throughput::run (int argc, char* argv[]) poa_manager->activate (TAO_TRY_ENV); TAO_CHECK_ENV; - this->connect_consumers (channel.in (), TAO_TRY_ENV); + this->connect_consumers (scheduler.in (), channel.in (), TAO_TRY_ENV); TAO_CHECK_ENV; ACE_DEBUG ((LM_DEBUG, "connected consumer(s)\n")); - this->connect_suppliers (channel.in (), TAO_TRY_ENV); + this->connect_suppliers (scheduler.in (), + channel.in (), + TAO_TRY_ENV); TAO_CHECK_ENV; ACE_DEBUG ((LM_DEBUG, "connected supplier(s)\n")); @@ -254,8 +258,10 @@ ECT_Throughput::run (int argc, char* argv[]) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "orb->run"), -1); ACE_DEBUG ((LM_DEBUG, "event loop finished\n")); +#if 0 naming_context->unbind (schedule_name, TAO_TRY_ENV); TAO_CHECK_ENV; +#endif // Wait for the supplier threads... if (ACE_Thread_Manager::instance ()->wait () == -1) @@ -330,8 +336,10 @@ ECT_Throughput::shutdown_consumer (void*, } void -ECT_Throughput::connect_consumers (RtecEventChannelAdmin::EventChannel_ptr channel, - CORBA::Environment &TAO_IN_ENV) +ECT_Throughput::connect_consumers + (RtecScheduler::Scheduler_ptr scheduler, + RtecEventChannelAdmin::EventChannel_ptr channel, + CORBA::Environment &TAO_IN_ENV) { { ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->lock_); @@ -347,7 +355,8 @@ ECT_Throughput::connect_consumers (RtecEventChannelAdmin::EventChannel_ptr chann this->consumers_ + i, this->n_suppliers_)); - this->consumers_[i]->connect (buf, + this->consumers_[i]->connect (scheduler, + buf, this->event_a_, this->event_b_, channel, @@ -357,8 +366,10 @@ ECT_Throughput::connect_consumers (RtecEventChannelAdmin::EventChannel_ptr chann } void -ECT_Throughput::connect_suppliers (RtecEventChannelAdmin::EventChannel_ptr channel, - CORBA::Environment &TAO_IN_ENV) +ECT_Throughput::connect_suppliers + (RtecScheduler::Scheduler_ptr scheduler, + RtecEventChannelAdmin::EventChannel_ptr channel, + CORBA::Environment &TAO_IN_ENV) { for (int i = 0; i < this->n_suppliers_; ++i) { @@ -367,7 +378,8 @@ ECT_Throughput::connect_suppliers (RtecEventChannelAdmin::EventChannel_ptr chann ACE_NEW (this->suppliers_[i], Test_Supplier (this)); - this->suppliers_[i]->connect (buf, + this->suppliers_[i]->connect (scheduler, + buf, this->burst_count_, this->burst_size_, this->event_size_, diff --git a/TAO/orbsvcs/tests/EC_Throughput/ECT_Throughput.h b/TAO/orbsvcs/tests/EC_Throughput/ECT_Throughput.h index e944e134d40..a37826e2543 100644 --- a/TAO/orbsvcs/tests/EC_Throughput/ECT_Throughput.h +++ b/TAO/orbsvcs/tests/EC_Throughput/ECT_Throughput.h @@ -50,12 +50,14 @@ private: int parse_args (int argc, char* argv[]); // parse the command line args - void connect_consumers (RtecEventChannelAdmin::EventChannel_ptr local_ec, + void connect_consumers (RtecScheduler::Scheduler_ptr scheduler, + RtecEventChannelAdmin::EventChannel_ptr local_ec, CORBA::Environment &_env); void disconnect_consumers (CORBA::Environment &_env); // Connect and disconnect the consumers. - void connect_suppliers (RtecEventChannelAdmin::EventChannel_ptr local_ec, + void connect_suppliers (RtecScheduler::Scheduler_ptr scheduler, + RtecEventChannelAdmin::EventChannel_ptr local_ec, CORBA::Environment &_env); void disconnect_suppliers (CORBA::Environment &_env); // Connect the suppliers. |