Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Dev_Poll_Handler_Guard Class Reference

Class used to make event handler reference count manipulation exception-safe. More...

#include <Dev_Poll_Reactor.h>

Collaboration diagram for ACE_Dev_Poll_Handler_Guard:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_Dev_Poll_Handler_Guard (ACE_Dev_Poll_Reactor_Handler_Repository &repository, ACE_HANDLE handle)
 The constructor increments the reference count on the event handler corresponding to the given handle. More...

 ~ACE_Dev_Poll_Handler_Guard (void)
 The destructor decrements the reference count on the event handler corresponding to the given handle. More...


Private Attributes

ACE_Dev_Poll_Reactor_Handler_Repositoryrepository_
 Reference to the handler repository containing the event handler used during the upcall. More...

ACE_HANDLE handle_
 Handle corresponding to the event being dispatched. More...


Detailed Description

Class used to make event handler reference count manipulation exception-safe.

This class makes the reference count manipulation that occurs during an upcall exception-safe. Prior to dispatching the event handler, the reference count is increased. Once the upcall for the given event handler is complete, its reference count will be decreased.


Constructor & Destructor Documentation

ACE_INLINE ACE_Dev_Poll_Handler_Guard::ACE_Dev_Poll_Handler_Guard ACE_Dev_Poll_Reactor_Handler_Repository   repository,
ACE_HANDLE    handle
 

The constructor increments the reference count on the event handler corresponding to the given handle.

ACE_INLINE ACE_Dev_Poll_Handler_Guard::~ACE_Dev_Poll_Handler_Guard void   
 

The destructor decrements the reference count on the event handler corresponding to the given handle.

Todo:
Suspend the handler so that other threads will not cause an event that is already in an upcall from being dispatched again.

Note:
The naive approach would be to simply call suspend_handler_i() on the reactor. However, that would cause a system call (write()) to occur. Obviously this can potentially have an adverse affect on performance. Ideally, the handler would only be marked as "suspended" in the handler repository. If an event arrives for a suspended handler that event can be "queued" in a "handle readiness queue." "Queued" is quoted since a real queue need not be used since duplicate events can be coalesced, thus avoiding unbounded queue growth. Event coalescing is already done by Linux's event poll driver (/dev/epoll) so Solaris' poll driver (/dev/poll) is the main concern here. The largest the queue can be is the same size as the number of handlers stored in the handler repository.


Member Data Documentation

ACE_HANDLE ACE_Dev_Poll_Handler_Guard::handle_ [private]
 

Handle corresponding to the event being dispatched.

ACE_Dev_Poll_Reactor_Handler_Repository& ACE_Dev_Poll_Handler_Guard::repository_ [private]
 

Reference to the handler repository containing the event handler used during the upcall.


The documentation for this class was generated from the following files:
Generated on Thu Oct 10 17:06:24 2002 for ACE by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001