TAO_EC_RTCORBA_Dispatching Class Reference

RTCORBA-based dispatching strategy. More...

#include <EC_RTCORBA_Dispatching.h>

Inheritance diagram for TAO_EC_RTCORBA_Dispatching:

Inheritance graph
[legend]
Collaboration diagram for TAO_EC_RTCORBA_Dispatching:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_EC_RTCORBA_Dispatching (const RTCORBA::ThreadpoolLanes &lanes, RTCORBA::PriorityMapping *mapping, RTCORBA::Current_ptr current)
 Constructor.

 ~TAO_EC_RTCORBA_Dispatching (void)
 Destructor.

virtual void activate (void)
virtual void shutdown (void)
virtual void push (TAO_EC_ProxyPushSupplier *proxy, RtecEventComm::PushConsumer_ptr consumer, const RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info)
virtual void push_nocopy (TAO_EC_ProxyPushSupplier *proxy, RtecEventComm::PushConsumer_ptr consumer, RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info)

Private Attributes

RTCORBA::ThreadpoolLanes lanes_
 The thread pools...

RTCORBA::PriorityMapping * priority_mapping_
 Used to map between CORBA and native priorities.

RTCORBA::Current_var current_
 Used to get the current RTCORBA priority.

ACE_Thread_Manager thread_manager_
 Use our own thread manager.

TAO_EC_Dispatching_Tasktasks_
 The dispatching task(s), one per lane.


Detailed Description

RTCORBA-based dispatching strategy.

Definition at line 37 of file EC_RTCORBA_Dispatching.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_EC_RTCORBA_Dispatching::TAO_EC_RTCORBA_Dispatching const RTCORBA::ThreadpoolLanes &  lanes,
RTCORBA::PriorityMapping *  mapping,
RTCORBA::Current_ptr  current
 

Constructor.

Definition at line 11 of file EC_RTCORBA_Dispatching.cpp.

References ACE_NEW, lanes_, and ACE_Task_Base::thr_mgr().

00014     :  lanes_ (lanes)
00015     , priority_mapping_ (mapping)
00016     , current_ (RTCORBA::Current::_duplicate (current))
00017 {
00018   CORBA::ULong number_lanes = this->lanes_.length ();
00019   ACE_NEW (this->tasks_, TAO_EC_Dispatching_Task[number_lanes]);
00020   for (CORBA::ULong i = 0; i != this->lanes_.length (); ++i)
00021     this->tasks_[i].thr_mgr (&this->thread_manager_);
00022 }

TAO_EC_RTCORBA_Dispatching::~TAO_EC_RTCORBA_Dispatching void   ) 
 

Destructor.

Definition at line 24 of file EC_RTCORBA_Dispatching.cpp.

00025 {
00026   delete[] this->tasks_;
00027 }


Member Function Documentation

void TAO_EC_RTCORBA_Dispatching::activate void   )  [virtual]
 

Initialize all the data structures, activate any internal threads, etc.

Implements TAO_EC_Dispatching.

Definition at line 30 of file EC_RTCORBA_Dispatching.cpp.

References ACE_Task_Base::activate(), lanes_, and priority_mapping_.

00031 {
00032   for (CORBA::ULong i = 0; i != this->lanes_.length (); ++i)
00033     {
00034       CORBA::ULong nthreads = this->lanes_[i].static_threads;
00035       if (nthreads == 0)
00036         {
00037           nthreads = 1;
00038         }
00039       RTCORBA::Priority corba_priority = this->lanes_[i].lane_priority;
00040       RTCORBA::NativePriority native_priority;
00041       if (this->priority_mapping_->to_native (corba_priority,
00042                                               native_priority) != 0)
00043         {
00044           this->tasks_[i].activate (
00045               THR_SCHED_FIFO | THR_NEW_LWP | THR_JOINABLE,
00046               nthreads, 0,
00047               native_priority);
00048         }
00049     }
00050 }

void TAO_EC_RTCORBA_Dispatching::push TAO_EC_ProxyPushSupplier proxy,
RtecEventComm::PushConsumer_ptr  consumer,
const RtecEventComm::EventSet event,
TAO_EC_QOS_Info qos_info
[virtual]
 

Definition at line 70 of file EC_RTCORBA_Dispatching.cpp.

References ACE_ENV_ARG_PARAMETER, RtecEventComm::EventSet, and push_nocopy().

00075 {
00076   RtecEventComm::EventSet event_copy = event;
00077   this->push_nocopy (proxy, consumer, event_copy, qos_info ACE_ENV_ARG_PARAMETER);
00078 }

void TAO_EC_RTCORBA_Dispatching::push_nocopy TAO_EC_ProxyPushSupplier proxy,
RtecEventComm::PushConsumer_ptr  consumer,
RtecEventComm::EventSet event,
TAO_EC_QOS_Info qos_info
[virtual]
 

Definition at line 81 of file EC_RTCORBA_Dispatching.cpp.

References ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, RtecEventComm::EventSet, lanes_, and TAO_EC_Dispatching_Task::push().

Referenced by push().

00086 {
00087   RTCORBA::Priority current_priority =
00088     this->current_->the_priority (ACE_ENV_SINGLE_ARG_PARAMETER);
00089   ACE_CHECK;
00090 
00091   for (CORBA::ULong i = 0; i != this->lanes_.length (); ++i)
00092     {
00093       if (this->lanes_[i].lane_priority != current_priority)
00094         continue;
00095 
00096       // @@ If there were no threads available we may need to create
00097       // some...
00098 
00099       this->tasks_[i].push (proxy, consumer, event
00100                             ACE_ENV_ARG_PARAMETER);
00101       ACE_CHECK;
00102       break;
00103     }
00104 }

void TAO_EC_RTCORBA_Dispatching::shutdown void   )  [virtual]
 

Deactivate any internal threads and cleanup internal data structures, it should only return once the threads have finished their jobs.

Implements TAO_EC_Dispatching.

Definition at line 53 of file EC_RTCORBA_Dispatching.cpp.

References lanes_, ACE_Thread_Manager::num_threads_in_task(), ACE_Task< ACE_SYNCH >::putq(), and ACE_Thread_Manager::wait().

00054 {
00055   for (CORBA::ULong i = 0; i != this->lanes_.length (); ++i)
00056     {
00057       int nthreads =
00058         this->thread_manager_.num_threads_in_task (&this->tasks_[i]);
00059       if (nthreads <= 0)
00060         continue;
00061       for (int j = 0; j != nthreads; ++j)
00062         {
00063           this->tasks_[i].putq (new TAO_EC_Shutdown_Task_Command);
00064         }
00065     }
00066   this->thread_manager_.wait ();
00067 }


Member Data Documentation

RTCORBA::Current_var TAO_EC_RTCORBA_Dispatching::current_ [private]
 

Used to get the current RTCORBA priority.

Definition at line 70 of file EC_RTCORBA_Dispatching.h.

RTCORBA::ThreadpoolLanes TAO_EC_RTCORBA_Dispatching::lanes_ [private]
 

The thread pools...

Definition at line 64 of file EC_RTCORBA_Dispatching.h.

Referenced by activate(), push_nocopy(), shutdown(), and TAO_EC_RTCORBA_Dispatching().

RTCORBA::PriorityMapping* TAO_EC_RTCORBA_Dispatching::priority_mapping_ [private]
 

Used to map between CORBA and native priorities.

Definition at line 67 of file EC_RTCORBA_Dispatching.h.

Referenced by activate().

TAO_EC_Dispatching_Task* TAO_EC_RTCORBA_Dispatching::tasks_ [private]
 

The dispatching task(s), one per lane.

Definition at line 76 of file EC_RTCORBA_Dispatching.h.

ACE_Thread_Manager TAO_EC_RTCORBA_Dispatching::thread_manager_ [private]
 

Use our own thread manager.

Definition at line 73 of file EC_RTCORBA_Dispatching.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:15:34 2006 for TAO_RTEvent by doxygen 1.3.6