EC_MT_Dispatching.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 /**
00004  *  @file   EC_MT_Dispatching.h
00005  *
00006  *  $Id: EC_MT_Dispatching.h 76589 2007-01-25 18:04:11Z elliott_c $
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_MT_DISPATCHING_H
00017 #define TAO_EC_MT_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/Event/EC_Dispatching_Task.h"
00027 
00028 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00029 
00030 /**
00031  * @class TAO_EC_MT_Dispatching
00032  *
00033  * @brief Dispatching strategy that minimizes mt inversion.
00034  *
00035  * This strategy uses a single queue, serviced by one or more
00036  * threads.  It's main purpose is to decouple the suppliers from
00037  * the client execution time, specially in the collocated case.
00038  */
00039 class TAO_RTEvent_Serv_Export TAO_EC_MT_Dispatching : public TAO_EC_Dispatching
00040 {
00041 public:
00042   /// Constructor
00043   /// It will create @a nthreads servicing threads...
00044   TAO_EC_MT_Dispatching (int nthreads,
00045                          int thread_creation_flags,
00046                          int thread_priority,
00047                          int force_activate,
00048                          TAO_EC_Queue_Full_Service_Object* queue_full_service_object_name);
00049 
00050   // = The EC_Dispatching methods.
00051   virtual void activate (void);
00052   virtual void shutdown (void);
00053   virtual void push (TAO_EC_ProxyPushSupplier* proxy,
00054                      RtecEventComm::PushConsumer_ptr consumer,
00055                      const RtecEventComm::EventSet& event,
00056                      TAO_EC_QOS_Info& qos_info);
00057   virtual void push_nocopy (TAO_EC_ProxyPushSupplier* proxy,
00058                             RtecEventComm::PushConsumer_ptr consumer,
00059                             RtecEventComm::EventSet& event,
00060                             TAO_EC_QOS_Info& qos_info);
00061 
00062 private:
00063   /// Use our own thread manager.
00064   ACE_Thread_Manager thread_manager_;
00065 
00066   /// The number of active tasks
00067   int nthreads_;
00068 
00069   /// The flags (THR_BOUND, THR_NEW_LWP, etc.) used to create the
00070   /// dispatching threads.
00071   int thread_creation_flags_;
00072 
00073   /// The priority of the dispatching threads.
00074   int thread_priority_;
00075 
00076   /// If activation at the requested priority fails then we fallback on
00077   /// the defaults for thread activation.
00078   int force_activate_;
00079 
00080   /// The dispatching task
00081   TAO_EC_Dispatching_Task task_;
00082 
00083   /// Synchronize access to internal data
00084   TAO_SYNCH_MUTEX lock_;
00085 
00086   /// Are the threads running?
00087   int active_;
00088 
00089   /// Service Object information
00090   TAO_EC_Queue_Full_Service_Object* queue_full_service_object_;
00091 };
00092 
00093 TAO_END_VERSIONED_NAMESPACE_DECL
00094 
00095 #include /**/ "ace/post.h"
00096 #endif /* TAO_EC_MT_DISPATCHING_H */

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