CEC_MT_Dispatching.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   CEC_MT_Dispatching.h
00006  *
00007  *  $Id: CEC_MT_Dispatching.h 76589 2007-01-25 18:04:11Z elliott_c $
00008  *
00009  *  @author Carlos O'Ryan (coryan@cs.wustl.edu)
00010  */
00011 //=============================================================================
00012 
00013 
00014 #ifndef TAO_CEC_MT_DISPATCHING_H
00015 #define TAO_CEC_MT_DISPATCHING_H
00016 
00017 #include /**/ "ace/pre.h"
00018 
00019 #include "orbsvcs/CosEvent/CEC_Dispatching.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 #include "orbsvcs/CosEvent/CEC_Dispatching_Task.h"
00026 
00027 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00028 
00029 class TAO_CEC_EventChannel;
00030 
00031 /**
00032  * @class TAO_CEC_MT_Dispatching
00033  *
00034  * @brief Dispatching strategy that minimizes mt inversion.
00035  *
00036  * This strategy uses a single queue, serviced by one or more
00037  * threads.  It's main purpose is to decouple the suppliers from
00038  * the client execution time, specially in the collocated case.
00039  */
00040 class TAO_Event_Serv_Export TAO_CEC_MT_Dispatching : public TAO_CEC_Dispatching
00041 {
00042 public:
00043   /// Constructor
00044   /// It will create <nthreads> servicing threads...
00045   TAO_CEC_MT_Dispatching (int nthreads,
00046                          int thread_creation_flags,
00047                          int thread_priority,
00048                          int force_activate);
00049 
00050   // = The EC_Dispatching methods.
00051   virtual void activate (void);
00052   virtual void shutdown (void);
00053   virtual void push (TAO_CEC_ProxyPushSupplier* proxy,
00054                      const CORBA::Any & event);
00055   virtual void push_nocopy (TAO_CEC_ProxyPushSupplier* proxy,
00056                             CORBA::Any& event);
00057 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00058   virtual void invoke (TAO_CEC_ProxyPushSupplier *proxy,
00059                        const TAO_CEC_TypedEvent & typed_event);
00060   virtual void invoke_nocopy (TAO_CEC_ProxyPushSupplier *proxy,
00061                               TAO_CEC_TypedEvent & typed_event);
00062 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
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_CEC_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 
00092 TAO_END_VERSIONED_NAMESPACE_DECL
00093 
00094 #include /**/ "ace/post.h"
00095 
00096 #endif /* TAO_CEC_MT_DISPATCHING_H */

Generated on Tue Feb 2 17:44:51 2010 for TAO_CosEvent by  doxygen 1.4.7