=default for generated implementation copy ctor
[ACE_TAO.git] / TAO / examples / Callback_Quoter / Consumer_Signal_Handler.cpp
blob0d7f1084e24b45d178909e8304e96463409d63ea
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file Consumer_Signal_Handler.cpp
7 * Implementation of the Consumer_Signal_Handler class.
9 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
11 //=============================================================================
13 #include "Consumer_Signal_Handler.h"
15 Consumer_Signal_Handler::Consumer_Signal_Handler (Consumer_Handler *consumer_handler)
16 : consumer_handler_ (consumer_handler)
20 // Method to handle the ^C signal.
21 int
22 Consumer_Signal_Handler::handle_signal (int /* signum */,
23 siginfo_t*,
24 ucontext_t*)
26 ACE_DEBUG ((LM_DEBUG, " Exiting on receiving ^C\n"));
28 quit_on_signal ();
30 return 0;
33 // Method called before the Event_Handler dies.
34 int
35 Consumer_Signal_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask)
37 // End of the signal handler.
38 delete this;
40 return 0;
43 int
44 Consumer_Signal_Handler::quit_on_signal ()
46 // Only if the consumer is registered and wants to shut down, its
47 // necessary to unregister and then shutdown.
48 try
50 if (consumer_handler_->unregistered_ != 1
51 && consumer_handler_->registered_ == 1)
53 this->consumer_handler_->server_->unregister_callback
54 (this->consumer_handler_->consumer_var_.in ());
55 ACE_DEBUG ((LM_DEBUG,
56 "Consumer Unregistered\n"));
58 this->consumer_handler_->consumer_servant_->shutdown ();
60 catch (const CORBA::Exception& ex)
62 ex._tao_print_exception (
63 "Consumer_Input_Handler::quit_consumer_process()");
64 return -1;
67 return 0;