blob: 0d7f1084e24b45d178909e8304e96463409d63ea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/* -*- C++ -*- */
//=============================================================================
/**
* @file Consumer_Signal_Handler.cpp
*
* Implementation of the Consumer_Signal_Handler class.
*
* @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
*/
//=============================================================================
#include "Consumer_Signal_Handler.h"
Consumer_Signal_Handler::Consumer_Signal_Handler (Consumer_Handler *consumer_handler)
: consumer_handler_ (consumer_handler)
{
}
// Method to handle the ^C signal.
int
Consumer_Signal_Handler::handle_signal (int /* signum */,
siginfo_t*,
ucontext_t*)
{
ACE_DEBUG ((LM_DEBUG, " Exiting on receiving ^C\n"));
quit_on_signal ();
return 0;
}
// Method called before the Event_Handler dies.
int
Consumer_Signal_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask)
{
// End of the signal handler.
delete this;
return 0;
}
int
Consumer_Signal_Handler::quit_on_signal ()
{
// Only if the consumer is registered and wants to shut down, its
// necessary to unregister and then shutdown.
try
{
if (consumer_handler_->unregistered_ != 1
&& consumer_handler_->registered_ == 1)
{
this->consumer_handler_->server_->unregister_callback
(this->consumer_handler_->consumer_var_.in ());
ACE_DEBUG ((LM_DEBUG,
"Consumer Unregistered\n"));
}
this->consumer_handler_->consumer_servant_->shutdown ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception (
"Consumer_Input_Handler::quit_consumer_process()");
return -1;
}
return 0;
}
|