summaryrefslogtreecommitdiff
path: root/TAO/tests/NestedUpcall/MT_Client_Test/server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tests/NestedUpcall/MT_Client_Test/server.cpp')
-rw-r--r--TAO/tests/NestedUpcall/MT_Client_Test/server.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/TAO/tests/NestedUpcall/MT_Client_Test/server.cpp b/TAO/tests/NestedUpcall/MT_Client_Test/server.cpp
index 04dbf25ca9e..cc902da6345 100644
--- a/TAO/tests/NestedUpcall/MT_Client_Test/server.cpp
+++ b/TAO/tests/NestedUpcall/MT_Client_Test/server.cpp
@@ -21,8 +21,47 @@
#include "tao/debug.h"
#include "ace/OS_NS_stdio.h"
+#include "ace/Event_Handler.h"
+#include "ace/Sig_Handler.h"
+
ACE_RCSID(MT_Client_Test, server, "$Id$")
+class TestShutdown : public ACE_Event_Handler
+{
+public:
+ TestShutdown (CORBA::ORB_ptr orb)
+ : orb_(CORBA::ORB::_duplicate (orb))
+ {
+#if !defined(ACE_LACKS_UNIX_SIGNALS)
+ this->shutdown_.register_handler (SIGTERM, this);
+ this->shutdown_.register_handler (SIGINT, this);
+#elif defined(ACE_WIN32)
+ this->shutdown_.register_handler (SIGINT, this);
+#endif
+ }
+
+ ~TestShutdown (void)
+ {
+#if !defined(ACE_LACKS_UNIX_SIGNALS)
+ this->shutdown_.remove_handler (SIGTERM);
+ this->shutdown_.remove_handler (SIGINT);
+#elif defined(ACE_WIN32)
+ this->shutdown_.remove_handler (SIGINT);
+#endif
+ }
+
+ virtual int handle_signal (int, siginfo_t*, ucontext_t*)
+ {
+ this->orb_->shutdown ();
+ return 0;
+ }
+
+private:
+ CORBA::ORB_var orb_;
+
+ ACE_Sig_Handler shutdown_;
+};
+
MT_Object_Server::MT_Object_Server (void)
: ior_output_file_ (0)
{
@@ -103,6 +142,9 @@ MT_Object_Server::init (int argc, ACE_TCHAR** argv)
int
MT_Object_Server::run (void)
{
+ CORBA::ORB_var orb = this->orb_manager_.orb ();
+ TestShutdown killer (orb.in ());
+
int result = this->orb_manager_.run ();
if (result == -1)