EC_MT_Dispatching.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 /**
00004  *  @file   EC_MT_Dispatching.h
00005  *
00006  *  EC_MT_Dispatching.h,v 1.17 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_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                      ACE_ENV_ARG_DECL);
00058   virtual void push_nocopy (TAO_EC_ProxyPushSupplier* proxy,
00059                             RtecEventComm::PushConsumer_ptr consumer,
00060                             RtecEventComm::EventSet& event,
00061                             TAO_EC_QOS_Info& qos_info
00062                             ACE_ENV_ARG_DECL);
00063 
00064 private:
00065   /// Use our own thread manager.
00066   ACE_Thread_Manager thread_manager_;
00067 
00068   /// The number of active tasks
00069   int nthreads_;
00070 
00071   /// The flags (THR_BOUND, THR_NEW_LWP, etc.) used to create the
00072   /// dispatching threads.
00073   int thread_creation_flags_;
00074 
00075   /// The priority of the dispatching threads.
00076   int thread_priority_;
00077 
00078   /// If activation at the requested priority fails then we fallback on
00079   /// the defaults for thread activation.
00080   int force_activate_;
00081 
00082   /// The dispatching task
00083   TAO_EC_Dispatching_Task task_;
00084 
00085   /// Synchronize access to internal data
00086   TAO_SYNCH_MUTEX lock_;
00087 
00088   /// Are the threads running?
00089   int active_;
00090 
00091   /// Service Object information
00092   TAO_EC_Queue_Full_Service_Object* queue_full_service_object_;
00093 };
00094 
00095 TAO_END_VERSIONED_NAMESPACE_DECL
00096 
00097 #include /**/ "ace/post.h"
00098 #endif /* TAO_EC_MT_DISPATCHING_H */

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