#include <Dev_Poll_Reactor.h>
Collaboration diagram for ACE_Dev_Poll_Handler_Guard:

Public Methods | |
| ACE_Dev_Poll_Handler_Guard (ACE_Dev_Poll_Reactor_Handler_Repository &repository, ACE_HANDLE handle) | |
| Constructor. More... | |
| ~ACE_Dev_Poll_Handler_Guard (void) | |
| Destructor. More... | |
Private Attributes | |
| ACE_Dev_Poll_Reactor_Handler_Repository & | repository_ |
| 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... | |
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.
Definition at line 1135 of file Dev_Poll_Reactor.h.
|
||||||||||||
|
Constructor. The constructor increments the reference count on the event handler corresponding to the given handle. Definition at line 136 of file Dev_Poll_Reactor.inl. References ACE_Dev_Poll_Reactor_Handler_Repository::add_ref.
00139 : repository_ (repository), 00140 handle_ (handle) 00141 { 00142 // Caller must provide synchronization. 00143 00144 (void) repository.add_ref (handle); 00145 00146 /** 00147 * @todo Suspend the handler so that other threads will not cause 00148 * an event that is already in an upcall from being dispatched 00149 * again. 00150 * 00151 * @note The naive approach would be to simply call 00152 * suspend_handler_i() on the reactor. However, that would 00153 * cause a system call (write()) to occur. Obviously this 00154 * can potentially have an adverse affect on performance. 00155 * Ideally, the handler would only be marked as "suspended" in 00156 * the handler repository. If an event arrives for a 00157 * suspended handler that event can be "queued" in a 00158 * "handle readiness queue." "Queued" is quoted since a real 00159 * queue need not be used since duplicate events can be 00160 * coalesced, thus avoiding unbounded queue growth. Event 00161 * coalescing is already done by Linux's event poll driver 00162 * (/dev/epoll) so Solaris' poll driver (/dev/poll) is the 00163 * main concern here. The largest the queue can be is the 00164 * same size as the number of handlers stored in the handler 00165 * repository. 00166 */ 00167 } |
|
|
Destructor. The destructor decrements the reference count on the event handler corresponding to the given handle. Definition at line 170 of file Dev_Poll_Reactor.inl. References ACE_Dev_Poll_Reactor_Handler_Repository::remove_ref, and repository_.
00171 {
00172 // Caller must provide synchronization.
00173
00174 (void) this->repository_.remove_ref (this->handle_);
00175
00176 /**
00177 * @todo Resume the handler so that other threads will be allowed to
00178 * dispatch the handler.
00179 */
00180 }
|
|
|
Handle corresponding to the event being dispatched.
Definition at line 1162 of file Dev_Poll_Reactor.h. |
|
|
Reference to the handler repository containing the event handler used during the upcall.
Definition at line 1159 of file Dev_Poll_Reactor.h. Referenced by ~ACE_Dev_Poll_Handler_Guard. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002