EC_Kokyu_Dispatching.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 /**
00004  *  @file   EC_Kokyu_Dispatching.h
00005  *
00006  *  EC_Kokyu_Dispatching.h,v 1.13 2006/03/14 06:14:25 jtc Exp
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                      ACE_ENV_ARG_DECL);
00072   virtual void push_nocopy (TAO_EC_ProxyPushSupplier* proxy,
00073                             RtecEventComm::PushConsumer_ptr consumer,
00074                             RtecEventComm::EventSet& event,
00075                             TAO_EC_QOS_Info& qos_info
00076                             ACE_ENV_ARG_DECL);
00077 
00078 private:
00079   ACE_Allocator *allocator_;
00080 
00081   void setup_lanes (void);
00082 
00083   /// The dispatcher
00084   Kokyu::Dispatcher_Auto_Ptr dispatcher_;
00085 
00086   /// The scheduler
00087   RtecScheduler::Scheduler_var scheduler_;
00088 
00089   int lanes_setup_;
00090   int disp_sched_policy_;
00091   int disp_sched_scope_;
00092 };
00093 
00094 // ****************************************************************
00095 
00096 class TAO_RTKokyuEvent_Export TAO_EC_Kokyu_Shutdown_Command : public Kokyu::Dispatch_Command
00097 {
00098 public:
00099   /// Constructor
00100   TAO_EC_Kokyu_Shutdown_Command (ACE_Allocator *allocator);
00101 
00102   /// Command callback
00103   virtual int execute (void);
00104 
00105 protected:
00106   //Protected so can't be put on stack; must be dynamically allocated
00107   virtual ~TAO_EC_Kokyu_Shutdown_Command (void);
00108 
00109 };
00110 
00111 // ****************************************************************
00112 
00113 class TAO_RTKokyuEvent_Export TAO_EC_Kokyu_Push_Command : public Kokyu::Dispatch_Command
00114 {
00115 public:
00116   /// Constructor
00117   TAO_EC_Kokyu_Push_Command (TAO_EC_ProxyPushSupplier* proxy,
00118                              RtecEventComm::PushConsumer_ptr consumer,
00119                              RtecEventComm::EventSet& event,
00120                              ACE_Allocator* allocator);
00121 
00122   /// Command callback
00123   virtual int execute (void);
00124 
00125 protected:
00126   //Protected so can't be put on stack; must be dynamically allocated
00127   virtual ~TAO_EC_Kokyu_Push_Command (void);
00128 
00129 private:
00130   /// The proxy
00131   TAO_EC_ProxyPushSupplier* proxy_;
00132 
00133   /// The consumer connected to the proxy when the event was pushed.
00134   RtecEventComm::PushConsumer_var consumer_;
00135 
00136   /// The event
00137   RtecEventComm::EventSet event_;
00138 };
00139 
00140 TAO_END_VERSIONED_NAMESPACE_DECL
00141 
00142 #if defined (__ACE_INLINE__)
00143 #include "orbsvcs/Event/EC_Kokyu_Dispatching.i"
00144 #endif /* __ACE_INLINE__ */
00145 
00146 #include /**/ "ace/post.h"
00147 #endif /* TAO_EC_KOKYU_DISPATCHING_H */

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