ReactorSynch.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #ifndef OPENDDS_DCPS_REACTORSYNCH_H
00009 #define OPENDDS_DCPS_REACTORSYNCH_H
00010 
00011 #include "ThreadSynch.h"
00012 #include "ScheduleOutputHandler.h"
00013 
00014 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00015 
00016 namespace OpenDDS { namespace DCPS {
00017 
00018 /**
00019  * @class ReactorSynch
00020  *
00021  * @brief Send thread synchronization utilizing a reactor.
00022  *
00023  * This class implements sending thread synchronization by scheduling
00024  * qeueued data sending to be handled by a reactor.  The initial
00025  * implementation will share the TransportReactorTask reactor for all
00026  * sending threads; which means that all receiving and queued sends will
00027  * be sharing the same thread.  Or thread pool.
00028  *
00029  * Calls to enable and disable sending on queued data by the reactor are
00030  * scheduled to be enabled and disabled on the reactor by notifying the
00031  * reactor to make the update.  This ensures that no locks will be held
00032  * (other than the Reactor::token_) when the call into the reactor is
00033  * made.
00034  *
00035  * References to the containing TransportSendStrategy and the reactor are
00036  * held as raw pointers since they are guaranteed to be valid for the
00037  * lifetime of this object (this is held in the same containing object).
00038  */
00039 class ReactorSynch : public ThreadSynch {
00040 public:
00041   /// Construct with raw pointers from the containing
00042   /// TransportSendStrategy.
00043   ReactorSynch(ThreadSynchResource* synch_resource,
00044                TransportSendStrategy* strategy,
00045                ACE_Reactor* reactor);
00046 
00047   virtual ~ReactorSynch();
00048 
00049   virtual void work_available();
00050 
00051 private:
00052   /// Notification event handler.
00053   ScheduleOutputHandler* scheduleOutputHandler_;
00054 
00055   /// Memory management using the provided (kluge) var type.
00056   ACE_Event_Handler_var safeHandler_;
00057 };
00058 
00059 }} // End namespace OpenDDS::DCPS
00060 
00061 OPENDDS_END_VERSIONED_NAMESPACE_DECL
00062 
00063 #if defined (__ACE_INLINE__)
00064 #include "ReactorSynch.inl"
00065 #endif /* __ACE_INLINE__ */
00066 
00067 #endif  /* OPENDDS_DCPS_REACTORSYNCH_H */
00068 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1