1 #include "ace/Event_Handler_Handle_Timeout_Upcall.h"
2 #include "ace/Reactor_Timer_Interface.h"
3 #include "ace/Abstract_Timer_Queue.h"
5 #if !defined(__ACE_INLINE__)
6 # include "ace/Event_Handler_Handle_Timeout_Upcall.inl"
7 #endif /* __ACE_INLINE__ */
9 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
11 ACE_ALLOC_HOOK_DEFINE(ACE_Event_Handler_Handle_Timeout_Upcall
)
13 ACE_Event_Handler_Handle_Timeout_Upcall::
14 ACE_Event_Handler_Handle_Timeout_Upcall (void) :
15 requires_reference_counting_ (0)
19 ACE_Event_Handler_Handle_Timeout_Upcall::
20 ~ACE_Event_Handler_Handle_Timeout_Upcall (void)
25 ACE_Event_Handler_Handle_Timeout_Upcall::
26 timeout (ACE_Timer_Queue
&timer_queue
,
27 ACE_Event_Handler
*event_handler
,
30 const ACE_Time_Value
&cur_time
)
32 int requires_reference_counting
= 0;
36 requires_reference_counting
=
37 event_handler
->reference_counting_policy ().value () ==
38 ACE_Event_Handler::Reference_Counting_Policy::ENABLED
;
41 // Upcall to the <handler>s handle_timeout method.
42 if (event_handler
->handle_timeout (cur_time
, act
) == -1)
44 if (event_handler
->reactor_timer_interface ())
45 event_handler
->reactor_timer_interface ()->cancel_timer (event_handler
, 0);
47 timer_queue
.cancel (event_handler
, 0); // 0 means "call handle_close()".
50 if (!recurring_timer
&&
51 requires_reference_counting
)
53 event_handler
->remove_reference ();
60 ACE_Event_Handler_Handle_Timeout_Upcall::
61 cancel_type (ACE_Timer_Queue
&,
62 ACE_Event_Handler
*event_handler
,
64 int &requires_reference_counting
)
66 requires_reference_counting
=
67 event_handler
->reference_counting_policy ().value () ==
68 ACE_Event_Handler::Reference_Counting_Policy::ENABLED
;
70 // Upcall to the <handler>s handle_close method
72 event_handler
->handle_close (ACE_INVALID_HANDLE
,
73 ACE_Event_Handler::TIMER_MASK
);
79 ACE_Event_Handler_Handle_Timeout_Upcall::
80 deletion (ACE_Timer_Queue
&timer_queue
,
81 ACE_Event_Handler
*event_handler
,
84 int requires_reference_counting
= 0;
86 this->cancel_type (timer_queue
,
89 requires_reference_counting
);
91 this->cancel_timer (timer_queue
,
94 requires_reference_counting
);
99 ACE_END_VERSIONED_NAMESPACE_DECL