Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / examples / Event_Comm / notifier.cpp
blob7596f378a0fafae9de5c9ef812d04170cc7f0b93
1 #include "Notifier_Server.h"
2 #include "notifier.h"
4 int
5 Notifier::handle_signal (int signum, siginfo_t *, ucontext_t *)
7 ACE_DEBUG ((LM_DEBUG,
8 "got signal in handle_signal %S\n",
9 signum));
11 // Tell the <Notifier_Server> to shut down the ORB.
12 ns_.close ();
13 return 0;
16 void
17 Notifier::run (void)
19 try
21 ns_.run ();
23 catch (const CORBA::Exception&)
25 return;
29 Notifier::Notifier (int argc, ACE_TCHAR *argv[])
31 try
33 ns_.init (argc, argv);
35 catch (const CORBA::Exception& ex)
37 ex._tao_print_exception ("Notifier_Server.init failed\n");
40 // Register with the ORB's Reactor to receive a signal to shut us
41 // down.
42 if (ns_.reactor ()->register_handler (SIGINT, this) == -1)
43 ACE_ERROR ((LM_ERROR,
44 "%p\n",
45 "register_handler"));
48 Notifier::~Notifier (void)
50 // Cleanup.
51 this->ns_.close ();
54 int
55 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
57 // Initialize server daemon.
58 Notifier notifier (argc, argv);
60 // Loop forever handling events.
61 notifier.run ();
63 return 0;