ACE_Proactor_Handle_Timeout_Upcall Class Reference

Functor for ACE_Timer_Queue. More...

#include <Proactor.h>

Collaboration diagram for ACE_Proactor_Handle_Timeout_Upcall:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ACE_Proactor_Handle_Timeout_Upcall (void)
 Constructor.

int registration (TIMER_QUEUE &timer_queue, ACE_Handler *handler, const void *arg)
 This method is called when a timer is registered.

int preinvoke (TIMER_QUEUE &timer_queue, ACE_Handler *handler, const void *arg, int recurring_timer, const ACE_Time_Value &cur_time, const void *&upcall_act)
 This method is called before the timer expires.

int timeout (TIMER_QUEUE &timer_queue, ACE_Handler *handler, const void *arg, int recurring_timer, const ACE_Time_Value &cur_time)
 This method is called when the timer expires.

int postinvoke (TIMER_QUEUE &timer_queue, ACE_Handler *handler, const void *arg, int recurring_timer, const ACE_Time_Value &cur_time, const void *upcall_act)
 This method is called after the timer expires.

int cancel_type (TIMER_QUEUE &timer_queue, ACE_Handler *handler, int dont_call_handle_close, int &requires_reference_counting)
 This method is called when a handler is canceled.

int cancel_timer (TIMER_QUEUE &timer_queue, ACE_Handler *handler, int dont_call_handle_close, int requires_reference_counting)
 This method is called when a timer is canceled.

int deletion (TIMER_QUEUE &timer_queue, ACE_Handler *handler, const void *arg)

Protected Member Functions

int proactor (ACE_Proactor &proactor)
 Set the proactor. This will fail, if one is already set!


Protected Attributes

ACE_Proactorproactor_

Private Types

typedef ACE_Timer_Queue_T<
ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall,
ACE_SYNCH_RECURSIVE_MUTEX > 
TIMER_QUEUE
 Type def for the timer queue.


Friends

class ACE_Proactor
 The main Proactor class has special permissions.


Detailed Description

Functor for ACE_Timer_Queue.

This class implements the functor required by the Timer Queue to call on ACE_Handlers.

Definition at line 54 of file Proactor.h.


Member Typedef Documentation

typedef ACE_Timer_Queue_T<ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX> ACE_Proactor_Handle_Timeout_Upcall::TIMER_QUEUE [private]
 

Type def for the timer queue.

Definition at line 61 of file Proactor.h.

Referenced by cancel_timer(), cancel_type(), deletion(), postinvoke(), preinvoke(), registration(), and timeout().


Constructor & Destructor Documentation

ACE_Proactor_Handle_Timeout_Upcall::ACE_Proactor_Handle_Timeout_Upcall void   ) 
 

Constructor.

Definition at line 173 of file Proactor.cpp.

00174   : proactor_ (0)
00175 {
00176 }


Member Function Documentation

int ACE_Proactor_Handle_Timeout_Upcall::cancel_timer TIMER_QUEUE timer_queue,
ACE_Handler handler,
int  dont_call_handle_close,
int  requires_reference_counting
 

This method is called when a timer is canceled.

Definition at line 265 of file Proactor.cpp.

References TIMER_QUEUE.

00269 {
00270   // Do nothing
00271   return 0;
00272 }

int ACE_Proactor_Handle_Timeout_Upcall::cancel_type TIMER_QUEUE timer_queue,
ACE_Handler handler,
int  dont_call_handle_close,
int &  requires_reference_counting
 

This method is called when a handler is canceled.

Definition at line 255 of file Proactor.cpp.

References TIMER_QUEUE.

00259 {
00260   // Do nothing
00261   return 0;
00262 }

int ACE_Proactor_Handle_Timeout_Upcall::deletion TIMER_QUEUE timer_queue,
ACE_Handler handler,
const void *  arg
 

This method is called when the timer queue is destroyed and the timer is still contained in it.

Definition at line 275 of file Proactor.cpp.

References TIMER_QUEUE.

00278 {
00279   // Do nothing
00280   return 0;
00281 }

int ACE_Proactor_Handle_Timeout_Upcall::postinvoke TIMER_QUEUE timer_queue,
ACE_Handler handler,
const void *  arg,
int  recurring_timer,
const ACE_Time_Value cur_time,
const void *  upcall_act
 

This method is called after the timer expires.

Definition at line 198 of file Proactor.cpp.

References TIMER_QUEUE.

00204 {
00205   return 0;
00206 }

int ACE_Proactor_Handle_Timeout_Upcall::preinvoke TIMER_QUEUE timer_queue,
ACE_Handler handler,
const void *  arg,
int  recurring_timer,
const ACE_Time_Value cur_time,
const void *&  upcall_act
 

This method is called before the timer expires.

Definition at line 187 of file Proactor.cpp.

References TIMER_QUEUE.

00193 {
00194   return 0;
00195 }

int ACE_Proactor_Handle_Timeout_Upcall::proactor ACE_Proactor proactor  )  [protected]
 

Set the proactor. This will fail, if one is already set!

Definition at line 284 of file Proactor.cpp.

References ACE_ERROR_RETURN, ACE_LIB_TEXT, and LM_ERROR.

00285 {
00286   if (this->proactor_ == 0)
00287     {
00288       this->proactor_ = &proactor;
00289       return 0;
00290     }
00291   else
00292     ACE_ERROR_RETURN ((LM_ERROR,
00293                        ACE_LIB_TEXT ("ACE_Proactor_Handle_Timeout_Upcall is only suppose")
00294                        ACE_LIB_TEXT (" to be used with ONE (and only one) Proactor\n")),
00295                       -1);
00296 }

int ACE_Proactor_Handle_Timeout_Upcall::registration TIMER_QUEUE timer_queue,
ACE_Handler handler,
const void *  arg
 

This method is called when a timer is registered.

Definition at line 179 of file Proactor.cpp.

References TIMER_QUEUE.

00182 {
00183   return 0;
00184 }

int ACE_Proactor_Handle_Timeout_Upcall::timeout TIMER_QUEUE timer_queue,
ACE_Handler handler,
const void *  arg,
int  recurring_timer,
const ACE_Time_Value cur_time
 

This method is called when the timer expires.

Definition at line 209 of file Proactor.cpp.

References ACE_ERROR_RETURN, ACE_LIB_TEXT, ACE_Proactor::create_asynch_timer(), ACE_Proactor::implementation(), LM_ERROR, ACE_Handler::proxy(), ACE_Auto_Basic_Ptr< X >::release(), and TIMER_QUEUE.

00214 {
00215   if (this->proactor_ == 0)
00216     ACE_ERROR_RETURN ((LM_ERROR,
00217                        ACE_LIB_TEXT ("(%t) No Proactor set in ACE_Proactor_Handle_Timeout_Upcall,")
00218                        ACE_LIB_TEXT (" no completion port to post timeout to?!@\n")),
00219                       -1);
00220 
00221   // Create the Asynch_Timer.
00222   ACE_Asynch_Result_Impl *asynch_timer =
00223     this->proactor_->create_asynch_timer (handler->proxy (),
00224                                           act,
00225                                           time,
00226                                           ACE_INVALID_HANDLE,
00227                                           0,
00228                                           -1);
00229 
00230   if (asynch_timer == 0)
00231     ACE_ERROR_RETURN ((LM_ERROR,
00232                        ACE_LIB_TEXT ("%N:%l:(%P | %t):%p\n"),
00233                        ACE_LIB_TEXT ("ACE_Proactor_Handle_Timeout_Upcall::timeout:")
00234                        ACE_LIB_TEXT ("create_asynch_timer failed")),
00235                       -1);
00236 
00237   auto_ptr<ACE_Asynch_Result_Impl> safe_asynch_timer (asynch_timer);
00238 
00239   // Post a completion.
00240   if (-1 == safe_asynch_timer->post_completion
00241       (this->proactor_->implementation ()))
00242     ACE_ERROR_RETURN ((LM_ERROR,
00243                        ACE_LIB_TEXT ("Failure in dealing with timers: ")
00244                        ACE_LIB_TEXT ("PostQueuedCompletionStatus failed\n")),
00245                       -1);
00246 
00247   // The completion has been posted.  The proactor is now responsible
00248   // for managing the asynch_timer memory.
00249   (void) safe_asynch_timer.release ();
00250 
00251   return 0;
00252 }


Friends And Related Function Documentation

friend class ACE_Proactor [friend]
 

The main Proactor class has special permissions.

Definition at line 64 of file Proactor.h.


Member Data Documentation

ACE_Proactor* ACE_Proactor_Handle_Timeout_Upcall::proactor_ [protected]
 

Handle to the proactor. This is needed for posting a timer result to the Proactor's completion queue.

Definition at line 122 of file Proactor.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:27:15 2006 for ACE by doxygen 1.3.6