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.

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.

References tasks_.

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 lanes_, THR_JOINABLE, THR_NEW_LWP, and THR_SCHED_FIFO.

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]

The consumer represented by proxy should receive event. It can use the information in qos_info to determine the event priority (among other things).

Implements TAO_EC_Dispatching.

Definition at line 70 of file EC_RTCORBA_Dispatching.cpp.

References push_nocopy().

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

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]

Implements TAO_EC_Dispatching.

Definition at line 80 of file EC_RTCORBA_Dispatching.cpp.

References current_, lanes_, TAO_EC_Dispatching_Task::push(), and tasks_.

Referenced by push().

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

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_, thread_manager_, 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 68 of file EC_RTCORBA_Dispatching.h.

Referenced by push_nocopy().

RTCORBA::ThreadpoolLanes TAO_EC_RTCORBA_Dispatching::lanes_ [private]

The thread pools...

Definition at line 62 of file EC_RTCORBA_Dispatching.h.

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

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

Used to map between CORBA and native priorities.

Definition at line 65 of file EC_RTCORBA_Dispatching.h.

TAO_EC_Dispatching_Task* TAO_EC_RTCORBA_Dispatching::tasks_ [private]

The dispatching task(s), one per lane.

Definition at line 74 of file EC_RTCORBA_Dispatching.h.

Referenced by push_nocopy(), and ~TAO_EC_RTCORBA_Dispatching().

ACE_Thread_Manager TAO_EC_RTCORBA_Dispatching::thread_manager_ [private]

Use our own thread manager.

Definition at line 71 of file EC_RTCORBA_Dispatching.h.

Referenced by shutdown().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:44:34 2010 for TAO_RTEvent by  doxygen 1.4.7