EC_Priority_Dispatching.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 /**
00004  *  @file   EC_Priority_Dispatching.h
00005  *
00006  *  EC_Priority_Dispatching.h,v 1.20 2006/03/14 06:14:25 jtc Exp
00007  *
00008  *  @author Carlos O'Ryan (coryan@cs.wustl.edu)
00009  *
00010  * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and
00011  * other members of the DOC group. More details can be found in:
00012  *
00013  * http://doc.ece.uci.edu/~coryan/EC/index.html
00014  */
00015 
00016 #ifndef TAO_EC_PRIORITY_DISPATCHING_H
00017 #define TAO_EC_PRIORITY_DISPATCHING_H
00018 #include /**/ "ace/pre.h"
00019 
00020 #include "orbsvcs/Event/EC_Dispatching.h"
00021 
00022 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00023 # pragma once
00024 #endif /* ACE_LACKS_PRAGMA_ONCE */
00025 
00026 #include "orbsvcs/RtecSchedulerC.h"
00027 #include "orbsvcs/Event/sched_event_export.h"
00028 
00029 #include "ace/Thread_Manager.h"
00030 
00031 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00032 
00033 class TAO_EC_Dispatching_Task;
00034 class TAO_EC_Event_Channel_Base;
00035 
00036 /**
00037  * @class TAO_EC_Priority_Dispatching
00038  *
00039  * @brief Dispatching strategy that minimizes priority inversion.
00040  *
00041  * This strategy uses multiple queues, each serviced by a thread
00042  * at different priority.  This minimizes priority inversion
00043  * because the consumers at higher priority are serviced before
00044  * consumers at lower priority.
00045  * It is more flexible than using the supplier thread to dispatch
00046  * because it allows high-priority suppliers to push events to
00047  * low-priority consumers (and vice-versa).
00048  * It also isolates the supplier threads from the time spent on
00049  * upcalls to the consumer objects, making the system easier to
00050  * analyze and schedule.
00051  */
00052 class TAO_RTSchedEvent_Export TAO_EC_Priority_Dispatching : public TAO_EC_Dispatching
00053 {
00054 public:
00055   /// The scheduler is used to find the range of priorities and similar
00056   /// info.
00057   TAO_EC_Priority_Dispatching (TAO_EC_Event_Channel_Base* ec);
00058 
00059   // = The EC_Dispatching methods.
00060   virtual void activate (void);
00061   virtual void shutdown (void);
00062   virtual void push (TAO_EC_ProxyPushSupplier* proxy,
00063                      RtecEventComm::PushConsumer_ptr consumer,
00064                      const RtecEventComm::EventSet& event,
00065                      TAO_EC_QOS_Info& qos_info
00066                      ACE_ENV_ARG_DECL);
00067   virtual void push_nocopy (TAO_EC_ProxyPushSupplier* proxy,
00068                             RtecEventComm::PushConsumer_ptr consumer,
00069                             RtecEventComm::EventSet& event,
00070                             TAO_EC_QOS_Info& qos_info
00071                             ACE_ENV_ARG_DECL);
00072 
00073 private:
00074   /// Use our own thread manager.
00075   ACE_Thread_Manager thread_manager_;
00076 
00077   /// The number of active tasks
00078   int ntasks_;
00079 
00080   /// The tasks..
00081   TAO_EC_Dispatching_Task** tasks_;
00082 
00083   /// The scheduler
00084   RtecScheduler::Scheduler_var scheduler_;
00085 };
00086 
00087 TAO_END_VERSIONED_NAMESPACE_DECL
00088 
00089 #include /**/ "ace/post.h"
00090 #endif /* TAO_EC_PRIORITY_DISPATCHING_H */

Generated on Thu Nov 9 13:11:08 2006 for TAO_RTEvent by doxygen 1.3.6