OpenDDS::DCPS::ReactorSynch Class Reference

Send thread synchronization utilizing a reactor. More...

#include <ReactorSynch.h>

Inheritance diagram for OpenDDS::DCPS::ReactorSynch:

Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::ReactorSynch:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ReactorSynch (ThreadSynchResource *synch_resource, TransportSendStrategy *strategy, ACE_Reactor *reactor)
virtual ~ReactorSynch ()
virtual void work_available ()

Private Attributes

ScheduleOutputHandlerscheduleOutputHandler_
 Notification event handler.
ACE_Event_Handler_var safeHandler_
 Memory management using the provided (kluge) var type.

Detailed Description

Send thread synchronization utilizing a reactor.

This class implements sending thread synchronization by scheduling qeueued data sending to be handled by a reactor. The initial implementation will share the TransportReactorTask reactor for all sending threads; which means that all receiving and queued sends will be sharing the same thread. Or thread pool.

Calls to enable and disable sending on queued data by the reactor are scheduled to be enabled and disabled on the reactor by notifying the reactor to make the update. This ensures that no locks will be held (other than the Reactor::token_) when the call into the reactor is made.

References to the containing TransportSendStrategy and the reactor are held as raw pointers since they are guaranteed to be valid for the lifetime of this object (this is held in the same containing object).

Definition at line 37 of file ReactorSynch.h.


Constructor & Destructor Documentation

ACE_INLINE OpenDDS::DCPS::ReactorSynch::ReactorSynch ( ThreadSynchResource synch_resource,
TransportSendStrategy strategy,
ACE_Reactor *  reactor 
)

Construct with raw pointers from the containing TransportSendStrategy.

Definition at line 12 of file ReactorSynch.inl.

References DBG_ENTRY_LVL, OpenDDS::DCPS::DCPS_debug_level, OpenDDS::DCPS::ThreadSynchWorker::id(), safeHandler_, scheduleOutputHandler_, and OpenDDS::DCPS::ThreadSynch::worker().

00017   : ThreadSynch(synch_resource),
00018     scheduleOutputHandler_( new ScheduleOutputHandler( strategy, reactor))
00019 {
00020   DBG_ENTRY_LVL("ReactorSynch","ReactorSynch",6);
00021 
00022   // Manage the handler storage using the provided _var.
00023   safeHandler_ = scheduleOutputHandler_;
00024 
00025   if (DCPS_debug_level > 4) {
00026     std::size_t id = 0;
00027     if( worker()) {
00028       id = worker()->id();
00029     }
00030     ACE_DEBUG((LM_DEBUG,
00031                ACE_TEXT("(%P|%t) ReactorSynch::ReactorSynch() [%d] - ")
00032                ACE_TEXT("establishing synch %C a worker.\n"),
00033                id,(worker()?"with":"without")));
00034   }
00035 }

OpenDDS::DCPS::ReactorSynch::~ReactorSynch (  )  [virtual]

Definition at line 16 of file ReactorSynch.cpp.

References DBG_ENTRY_LVL, OpenDDS::DCPS::DCPS_debug_level, OpenDDS::DCPS::ThreadSynchWorker::id(), scheduleOutputHandler_, and OpenDDS::DCPS::ThreadSynch::worker().

00017 {
00018   DBG_ENTRY_LVL("ReactorSynch","~ReactorSynch",6);
00019 
00020   // Release out unmanaged copy of the handler.
00021   // The managed copy will perform the actual delete.
00022   scheduleOutputHandler_ = 0;
00023 
00024   if (DCPS_debug_level > 4) {
00025     std::size_t id = 0;
00026     if( worker()) {
00027       id = worker()->id();
00028     }
00029     ACE_DEBUG((LM_DEBUG,
00030                ACE_TEXT("(%P|%t) ReactorSynch::~ReactorSynch() [%d] - ")
00031                ACE_TEXT("dismantling synch %C worker.\n"),
00032                id,(worker()?"with":"without")));
00033   }
00034 }


Member Function Documentation

void OpenDDS::DCPS::ReactorSynch::work_available (  )  [virtual]

The ThreadSynchWorker would like to have its perform_work() called from the appropriate thread once the ThreadSynchResource claims that it is_ready_for_work().

Implements OpenDDS::DCPS::ThreadSynch.

Definition at line 37 of file ReactorSynch.cpp.

References DBG_ENTRY_LVL, OpenDDS::DCPS::ScheduleOutputHandler::schedule_output(), and scheduleOutputHandler_.

00038 {
00039   DBG_ENTRY_LVL("ReactorSynch","work_available",6);
00040 
00041   // Schedule queued data to be sent by the reactor.
00042   scheduleOutputHandler_->schedule_output();
00043 }


Member Data Documentation

ACE_Event_Handler_var OpenDDS::DCPS::ReactorSynch::safeHandler_ [private]

Memory management using the provided (kluge) var type.

Definition at line 54 of file ReactorSynch.h.

Referenced by ReactorSynch().

ScheduleOutputHandler* OpenDDS::DCPS::ReactorSynch::scheduleOutputHandler_ [private]

Notification event handler.

Definition at line 51 of file ReactorSynch.h.

Referenced by ReactorSynch(), work_available(), and ~ReactorSynch().


The documentation for this class was generated from the following files:
Generated on Fri Feb 12 20:06:28 2016 for OpenDDS by  doxygen 1.4.7