GitHub Actions: Try MSVC builds with /std:c++17 and 20
[ACE_TAO.git] / ACE / ace / Event_Handler_Handle_Timeout_Upcall.cpp
blobf361e5aaeb49041e9d0d0086968c8eb126b802b1
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)
24 int
25 ACE_Event_Handler_Handle_Timeout_Upcall::
26 timeout (ACE_Timer_Queue &timer_queue,
27 ACE_Event_Handler *event_handler,
28 const void *act,
29 int recurring_timer,
30 const ACE_Time_Value &cur_time)
32 int requires_reference_counting = 0;
34 if (!recurring_timer)
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);
46 else
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 ();
56 return 0;
59 int
60 ACE_Event_Handler_Handle_Timeout_Upcall::
61 cancel_type (ACE_Timer_Queue &,
62 ACE_Event_Handler *event_handler,
63 int dont_call,
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
71 if (dont_call == 0)
72 event_handler->handle_close (ACE_INVALID_HANDLE,
73 ACE_Event_Handler::TIMER_MASK);
75 return 0;
78 int
79 ACE_Event_Handler_Handle_Timeout_Upcall::
80 deletion (ACE_Timer_Queue &timer_queue,
81 ACE_Event_Handler *event_handler,
82 const void *)
84 int requires_reference_counting = 0;
86 this->cancel_type (timer_queue,
87 event_handler,
89 requires_reference_counting);
91 this->cancel_timer (timer_queue,
92 event_handler,
94 requires_reference_counting);
96 return 0;
99 ACE_END_VERSIONED_NAMESPACE_DECL