Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / examples / Event_Comm / supplier.cpp
blob3e99cd2a8f1e4d2ab62ed202a970662e3bb3fc82
1 #include "Notifier_Handler.h"
2 #include "Supplier_Input_Handler.h"
3 #include "supplier.h"
5 int
6 Supplier::handle_signal (int signum, siginfo_t *, ucontext_t *)
8 ACE_DEBUG ((LM_DEBUG,
9 "%S\n",
10 signum));
12 this->close ();
13 return 0;
16 void
17 Supplier::run ()
19 if (nh_.run () == -1)
20 ACE_ERROR ((LM_ERROR,
21 "%p\n",
22 "Notifier_Handler::run"));
25 void
26 Supplier::close ()
28 ih_.close ();
29 nh_.close ();
32 int
33 Supplier::init (int argc, ACE_TCHAR *argv[])
35 if (this->nh_.init (argc, argv, this) == -1)
36 ACE_ERROR_RETURN ((LM_ERROR,
37 "%p\n",
38 "Notifier_Handler did not init\n"),
39 -1);
40 else if (this->ih_.initialize (&nh_) == -1)
41 ACE_ERROR_RETURN ((LM_ERROR,
42 "%p\n",
43 "Supplier Input handler did not init\n"),
44 -1);
45 else if (nh_.reactor ()->register_handler (SIGINT, this) == -1)
46 ACE_ERROR_RETURN ((LM_ERROR,
47 "%p\n",
48 "register_handler"),
49 -1);
50 ACE_DEBUG ((LM_DEBUG,
51 "Supplier initialized..\n"));
52 return 0;
55 int
56 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
58 // Initialize server daemon.
59 Supplier supplier;
61 try
63 if (supplier.init (argc, argv) == -1)
64 ACE_ERROR_RETURN ((LM_ERROR,
65 "%p\n",
66 "supplier init failed"),
67 1);
69 // Loop forever handling events.
70 supplier.run ();
72 catch (const ::CORBA::Exception &e)
74 e._tao_print_exception ("Caught unexpected CORBA exception : ");
75 return 1;
78 return 0;