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
)
14 ACE_Event_Handler_Handle_Timeout_Upcall::
15 timeout (ACE_Timer_Queue
&timer_queue
,
16 ACE_Event_Handler
*event_handler
,
19 const ACE_Time_Value
&cur_time
)
21 int requires_reference_counting
= 0;
25 requires_reference_counting
=
26 event_handler
->reference_counting_policy ().value () ==
27 ACE_Event_Handler::Reference_Counting_Policy::ENABLED
;
30 // Upcall to the <handler>s handle_timeout method.
31 if (event_handler
->handle_timeout (cur_time
, act
) == -1)
33 if (event_handler
->reactor_timer_interface ())
34 event_handler
->reactor_timer_interface ()->cancel_timer (event_handler
, 0);
36 timer_queue
.cancel (event_handler
, 0); // 0 means "call handle_close()".
39 if (!recurring_timer
&&
40 requires_reference_counting
)
42 event_handler
->remove_reference ();
49 ACE_Event_Handler_Handle_Timeout_Upcall::
50 cancel_type (ACE_Timer_Queue
&,
51 ACE_Event_Handler
*event_handler
,
53 int &requires_reference_counting
)
55 requires_reference_counting
=
56 event_handler
->reference_counting_policy ().value () ==
57 ACE_Event_Handler::Reference_Counting_Policy::ENABLED
;
59 // Upcall to the <handler>s handle_close method
61 event_handler
->handle_close (ACE_INVALID_HANDLE
,
62 ACE_Event_Handler::TIMER_MASK
);
68 ACE_Event_Handler_Handle_Timeout_Upcall::
69 deletion (ACE_Timer_Queue
&timer_queue
,
70 ACE_Event_Handler
*event_handler
,
73 int requires_reference_counting
= 0;
75 this->cancel_type (timer_queue
,
78 requires_reference_counting
);
80 this->cancel_timer (timer_queue
,
83 requires_reference_counting
);
88 ACE_END_VERSIONED_NAMESPACE_DECL