2424 */
2525// =============================================================================
2626
27-
2827#include " ace/OS_main.h"
2928
3029#if defined (ACE_WIN32)
3433#include " ace/OS_NS_unistd.h"
3534#include " ace/Log_Msg.h"
3635
37-
3836// Globals for this test
39- int stop_test = 0 ;
37+ bool stop_test = false ;
4038ACE_Reactor reactor;
4139
42-
4340class Simple_Handler : public ACE_Event_Handler
4441{
4542public:
46- // / Default constructor
47- Simple_Handler ();
43+ Simple_Handler () = default ;
4844
49- virtual int handle_signal (int signum, siginfo_t * = 0 , ucontext_t * = 0 );
50- virtual int handle_close (ACE_HANDLE handle,
51- ACE_Reactor_Mask close_mask);
45+ int handle_signal (int signum, siginfo_t * = nullptr , ucontext_t * = nullptr ) override ;
46+ int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask) override ;
5247
5348 ACE_Auto_Event event1_;
5449 ACE_Auto_Event event2_;
55- int handle_signal_count_;
56- int handle_close_count_;
50+ int handle_signal_count_ {} ;
51+ int handle_close_count_ {} ;
5752};
5853
59- Simple_Handler::Simple_Handler ()
60- : handle_signal_count_ (0 ),
61- handle_close_count_ (0 )
62- {
63- }
64-
6554int
6655Simple_Handler::handle_signal (int , siginfo_t *s, ucontext_t *)
6756{
68- ACE_HANDLE handle = s->si_handle_ ;
57+ ACE_HANDLE const handle = s->si_handle_ ;
6958 ACE_UNUSED_ARG (handle);
7059
71- this ->handle_signal_count_ ++ ;
60+ ++ this ->handle_signal_count_ ;
7261
7362 if (this ->handle_signal_count_ == 1 )
7463 this ->reactor ()->suspend_handler (event1_.handle ());
@@ -79,25 +68,22 @@ Simple_Handler::handle_signal (int, siginfo_t *s, ucontext_t *)
7968 }
8069 else if (this ->handle_signal_count_ == 3 )
8170 {
82- this ->reactor ()->remove_handler (event1_.handle (),
83- ACE_Event_Handler::NULL_MASK);
84- this ->reactor ()->remove_handler (event2_.handle (),
85- ACE_Event_Handler::NULL_MASK);
71+ this ->reactor ()->remove_handler (event1_.handle (), ACE_Event_Handler::NULL_MASK);
72+ this ->reactor ()->remove_handler (event2_.handle (), ACE_Event_Handler::NULL_MASK);
8673 }
8774 return 0 ;
8875}
8976
9077int
91- Simple_Handler::handle_close (ACE_HANDLE handle,
92- ACE_Reactor_Mask)
78+ Simple_Handler::handle_close (ACE_HANDLE handle, ACE_Reactor_Mask)
9379{
9480 ACE_DEBUG ((LM_DEBUG, " Simple_Handler::handle_close handle = %d\n " , handle));
95- this ->handle_close_count_ ++ ;
81+ ++ this ->handle_close_count_ ;
9682
9783 if (this ->handle_close_count_ == 1 )
98- stop_test = 0 ;
84+ stop_test = false ;
9985 else if (this ->handle_close_count_ == 2 )
100- stop_test = 1 ;
86+ stop_test = true ;
10187
10288 return 0 ;
10389}
@@ -134,12 +120,10 @@ worker ()
134120int
135121ACE_TMAIN (int , ACE_TCHAR *[])
136122{
137- int result = reactor.register_handler (&simple_handler,
138- simple_handler.event1_ .handle ());
123+ int result = reactor.register_handler (&simple_handler, simple_handler.event1_ .handle ());
139124 ACE_TEST_ASSERT (result == 0 );
140125
141- result = reactor.register_handler (&simple_handler,
142- simple_handler.event2_ .handle ());
126+ result = reactor.register_handler (&simple_handler, simple_handler.event2_ .handle ());
143127 ACE_TEST_ASSERT (result == 0 );
144128
145129 result = ACE_OS::thr_create ((ACE_THR_FUNC) worker, 0 , 0 , 0 );
0 commit comments