summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/Notify_Service/Notify_Server.cpp
blob: 53d761344a875d476347050c4c8b401b5677805b (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
// $Id$

#include "Notify_Service.h"

TAO_Notify_Service notify_service;

extern "C" void handler (int signum)
{
  // check of sigint
  if (signum == SIGINT)
    {
      ACE_DECLARE_NEW_CORBA_ENV;
      notify_service.shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
    }
}

// Driver function for the TAO Notify Service.

int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
  ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT);

  // Init factories.

  ACE_DECLARE_NEW_CORBA_ENV;

  if (notify_service.init (argc, argv ACE_ENV_ARG_PARAMETER) == -1)
    ACE_ERROR_RETURN ((LM_ERROR,
                       ACE_LIB_TEXT("Failed to initialize the Notification Service.\n")),
                      1);

  ACE_TRY
    {
      notify_service.run (ACE_ENV_SINGLE_ARG_PARAMETER);
      ACE_CHECK;
    }
  ACE_CATCHANY
    {
      ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
                           ACE_LIB_TEXT("Failed to run the Notification Service\n"));
      return 1;
    }
  ACE_ENDTRY;
  ACE_CHECK_RETURN (1);

  return 0;
}