blob: ad197822cb51dc1c7bd51180e72819e6b01b7350 (
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
/* -*- C++ -*- */
// $Id$
// ===========================================================
//
//
// = LIBRARY
// TAO/examples/Callback_Quoter
//
// = FILENAME
// Consumer_Input_Handler.cpp
//
// = DESCRIPTION
// 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;
}
Consumer_Signal_Handler:: ~Consumer_Signal_Handler ()
{
}
int
Consumer_Signal_Handler::handle_signal (int signum, siginfo_t*, ucontext_t*)
{
switch (signum)
{
case SIGWINCH:
ACE_DEBUG ((LM_DEBUG,
"Signal received on terminal window change!\n"));
quit_on_signal ();
break;
case SIGINT:
ACE_DEBUG ((LM_DEBUG,
" Exiting on receiving ^C\n"));
quit_on_signal ();
break;
}
return 0;
}
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.
CORBA::Environment TAO_TRY_ENV;
TAO_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 "));
TAO_CHECK_ENV;
}
this->consumer_handler_->consumer_servant_->shutdown (TAO_TRY_ENV);
}
TAO_CATCHANY
{
TAO_TRY_ENV.print_exception ("Consumer_Input_Handler::quit_consumer_process()");
return -1;
}
TAO_ENDTRY;
return 0;
}
|