EC_Kokyu_Dispatching.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 /**
00004  *  @file   EC_Kokyu_Dispatching.h
00005  *
00006  *  $Id: EC_Kokyu_Dispatching.h 76589 2007-01-25 18:04:11Z elliott_c $
00007  *
00008  *  @author Bryan Thrall (thrall@cs.wustl.edu)
00009  *
00010  * Based on previous work by Carlos O'Ryan (coryan@cs.wustl.edu) and
00011  * Tim Harrison (harrison@cs.wustl.edu) and other members of the DOC group.
00012  * More details can be found in:
00013  *
00014  * http://doc.ece.uci.edu/~coryan/EC/index.html
00015  */
00016 
00017 #ifndef TAO_EC_KOKYU_DISPATCHING_H
00018 #define TAO_EC_KOKYU_DISPATCHING_H
00019 #include /**/ "ace/pre.h"
00020 
00021 #include "orbsvcs/Event/EC_Dispatching.h"
00022 #include "orbsvcs/Event/EC_ProxySupplier.h"
00023 
00024 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00025 # pragma once
00026 #endif /* ACE_LACKS_PRAGMA_ONCE */
00027 
00028 #include "orbsvcs/RtecSchedulerC.h"
00029 #include "orbsvcs/Event/rtkokyu_event_export.h"
00030 
00031 #include "ace/Thread_Manager.h"
00032 
00033 #include "Kokyu/Kokyu.h"
00034 
00035 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00036 
00037 class TAO_EC_Event_Channel_Base;
00038 
00039 /**
00040  * @class TAO_EC_Kokyu_Dispatching
00041  *
00042  * @brief Dispatching strategy that minimizes priority inversion.
00043  *
00044  * This strategy uses multiple queues, each serviced by a thread
00045  * at different priority.  This minimizes priority inversion
00046  * because the consumers at higher priority are serviced before
00047  * consumers at lower priority.
00048  * It is more flexible than using the supplier thread to dispatch
00049  * because it allows high-priority suppliers to push events to
00050  * low-priority consumers (and vice-versa).
00051  * It also isolates the supplier threads from the time spent on
00052  * upcalls to the consumer objects, making the system easier to
00053  * analyze and schedule.
00054  */
00055 class TAO_RTKokyuEvent_Export TAO_EC_Kokyu_Dispatching : public TAO_EC_Dispatching
00056 {
00057 public:
00058   /// The scheduler is used to find the range of priorities and similar
00059   /// info.
00060   TAO_EC_Kokyu_Dispatching (TAO_EC_Event_Channel_Base* ec,
00061                             int sched_policy,
00062                             int sched_scope);
00063 
00064   // = The EC_Dispatching methods.
00065   virtual void activate (void);
00066   virtual void shutdown (void);
00067   virtual void push (TAO_EC_ProxyPushSupplier* proxy,
00068                      RtecEventComm::PushConsumer_ptr consumer,
00069                      const RtecEventComm::EventSet& event,
00070                      TAO_EC_QOS_Info& qos_info);
00071   virtual void push_nocopy (TAO_EC_ProxyPushSupplier* proxy,
00072                             RtecEventComm::PushConsumer_ptr consumer,
00073                             RtecEventComm::EventSet& event,
00074                             TAO_EC_QOS_Info& qos_info);
00075 
00076 private:
00077   ACE_Allocator *allocator_;
00078 
00079   void setup_lanes (void);
00080 
00081   /// The dispatcher
00082   Kokyu::Dispatcher_Auto_Ptr dispatcher_;
00083 
00084   /// The scheduler
00085   RtecScheduler::Scheduler_var scheduler_;
00086 
00087   int lanes_setup_;
00088   int disp_sched_policy_;
00089   int disp_sched_scope_;
00090 };
00091 
00092 // ****************************************************************
00093 
00094 class TAO_RTKokyuEvent_Export TAO_EC_Kokyu_Shutdown_Command : public Kokyu::Dispatch_Command
00095 {
00096 public:
00097   /// Constructor
00098   TAO_EC_Kokyu_Shutdown_Command (ACE_Allocator *allocator);
00099 
00100   /// Command callback
00101   virtual int execute (void);
00102 
00103 protected:
00104   //Protected so can't be put on stack; must be dynamically allocated
00105   virtual ~TAO_EC_Kokyu_Shutdown_Command (void);
00106 
00107 };
00108 
00109 // ****************************************************************
00110 
00111 class TAO_RTKokyuEvent_Export TAO_EC_Kokyu_Push_Command : public Kokyu::Dispatch_Command
00112 {
00113 public:
00114   /// Constructor
00115   TAO_EC_Kokyu_Push_Command (TAO_EC_ProxyPushSupplier* proxy,
00116                              RtecEventComm::PushConsumer_ptr consumer,
00117                              RtecEventComm::EventSet& event,
00118                              ACE_Allocator* allocator);
00119 
00120   /// Command callback
00121   virtual int execute (void);
00122 
00123 protected:
00124   //Protected so can't be put on stack; must be dynamically allocated
00125   virtual ~TAO_EC_Kokyu_Push_Command (void);
00126 
00127 private:
00128   /// The proxy
00129   TAO_EC_ProxyPushSupplier* proxy_;
00130 
00131   /// The consumer connected to the proxy when the event was pushed.
00132   RtecEventComm::PushConsumer_var consumer_;
00133 
00134   /// The event
00135   RtecEventComm::EventSet event_;
00136 };
00137 
00138 TAO_END_VERSIONED_NAMESPACE_DECL
00139 
00140 #if defined (__ACE_INLINE__)
00141 #include "orbsvcs/Event/EC_Kokyu_Dispatching.inl"
00142 #endif /* __ACE_INLINE__ */
00143 
00144 #include /**/ "ace/post.h"
00145 #endif /* TAO_EC_KOKYU_DISPATCHING_H */

Generated on Tue Feb 2 17:44:05 2010 for TAO_RTEvent by  doxygen 1.4.7