3 //=============================================================================
5 * @file Consumer_Signal_Handler.h
7 * Definition of the Consumer_Signal_Handler class.
9 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
11 //=============================================================================
14 #ifndef CONSUMER_SIGNAL_HANDLER_H
15 #define CONSUMER_SIGNAL_HANDLER_H
17 #include "ace/Reactor.h"
18 #include "ace/Event_Handler.h"
19 #include "Consumer_Handler.h"
21 class Consumer_Handler
;
24 * @class Consumer_Signal_Handler
26 * @brief Creating a class to handle signal events.
28 * Since only signals need to be handled, only the <handle_signal> method
31 class Consumer_Signal_Handler
: public ACE_Event_Handler
34 /// The consumer_handler reference will be used to access the servant
36 Consumer_Signal_Handler (Consumer_Handler
*consumer_handler
);
38 /// This method takes action on an signal event.
39 int handle_signal (int signum
,
41 ucontext_t
*) override
;
44 * For removal of the signal handler from the dispatch tables. When
45 * the handle_signal () returns < 0 this method will be executed
48 int handle_close (ACE_HANDLE handle
, ACE_Reactor_Mask close_mask
) override
;
51 /// Protected destructor so that the signal handler is always created
52 /// dynamically and hence the heap doesnt get corrupted.
53 ~Consumer_Signal_Handler () = default;
56 /// Exit gracefully on a signal.
57 int quit_on_signal ();
59 /// Reference to the Consumer_Handler which is used in accessing the
61 Consumer_Handler
*consumer_handler_
;
64 #endif /* CONSUMER_SIGNAL_HANDLER_H */