Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / examples / Callback_Quoter / Consumer_Signal_Handler.h
blob9cd7463ae4e130f83166399df687a81ce550145f
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
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;
23 /**
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
29 * is overlaoded.
31 class Consumer_Signal_Handler : public ACE_Event_Handler
33 public:
35 /// The consumer_handler refernce will be used to access the servant
36 /// methods.
37 Consumer_Signal_Handler (Consumer_Handler *consumer_handler);
39 /// This method takes action on an signal event.
40 int handle_signal (int signum,
41 siginfo_t*,
42 ucontext_t*);
44 /**
45 * For removal of the signal handler from the dispatch tables. When
46 * the handle_signal () returns < 0 this method will be executed
47 * automatically.
49 int handle_close (ACE_HANDLE handle,
50 ACE_Reactor_Mask close_mask);
52 protected:
53 /// Protected destructor so that the signal handler is always created
54 /// dynamically and hence the heap doesnt get corrupted.
55 ~Consumer_Signal_Handler (void);
57 private:
58 /// Exit gracefully on a signal.
59 int quit_on_signal (void);
61 /// Reference to the Consumer_Handler which is used in accessing the
62 /// servant methods.
63 Consumer_Handler *consumer_handler_;
66 #endif /* CONSUMER_SIGNAL_HANDLER_H */