//// This example is from the ACE Programmers Guide.
////  Chapter:  "The Reactor" (Event Management)
//// For details please see the guide at
//// http://www.cs.wustl.edu/~schmidt/ACE.html
////  AUTHOR: Umar Syyid ([email protected])
//// and Ambreen Ilyas ([email protected])

//Example 1
#include <signal.h>
#include "ace/Reactor.h"
#include "ace/Event_Handler.h"

//Create our subclass to handle the signal events
//that we wish to handle. Since we know that this particular
//event handler is going to be using signals we only overload the
//handle_signal method.

MyEventHandler: public ACE_Event_Handler{
handle_signal(int signum, siginfo_t*,ucontext_t*){
  case SIGWINCH:
   ACE_DEBUG((LM_DEBUG, "You pressed SIGWINCH \n"));

  case SIGINT:
   ACE_DEBUG((LM_DEBUG, "You pressed SIGINT \n"));
 return 0;

int main(int argc, char *argv[]){
 //instantiate the handler
 MyEventHandler *eh =new MyEventHandler;

//Register the handler asking to call back when either SIGWINCH
//or SIGINT signals occur. Note that in both the cases we asked the
//Reactor to call back the same Event_Handler i.e., MyEventHandler.
//This is the reason why we had to write a switch statement in the handle_signal()
//method above. Also note that the
//ACE_Reactor is being used as a Singleton object  (Singleton pattern)

  //Start the reactors event loop

 Next Example