File: main.cpp

package info (click to toggle)
ace 6.0.3%2Bdfsg-0.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 49,368 kB
  • sloc: cpp: 341,826; perl: 30,850; ansic: 20,952; makefile: 10,144; sh: 4,744; python: 828; exp: 787; yacc: 511; xml: 330; lex: 158; lisp: 116; csh: 48; tcl: 5
file content (55 lines) | stat: -rw-r--r-- 1,275 bytes parent folder | download | duplicates (2)
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
// $Id: main.cpp 91670 2010-09-08 18:02:26Z johnnyw $

#include "ace/Service_Config.h"
#include "ace/Reactor.h"
#include "ace/Filecache.h"

#include "HTTP_Server.h"
#include "ace/OS_main.h"
#include "ace/OS_NS_signal.h"

ACE_STATIC_SVC_REQUIRE(HTTP_Server)

#ifdef ACE_HAS_SIG_C_FUNC
extern "C"
{
#endif /* ACE_HAS_SIG_C_FUNC */

  // call exit() so that static destructors get called
static void
handler (int)
{
  delete (ACE_Filecache *) ACE_Filecache::instance ();
  ACE_OS::exit (0);
}

#ifdef ACE_HAS_SIG_C_FUNC
}
#endif /* ACE_HAS_SIG_C_FUNC */

// This is the driver entry point into JAWS.  It is possible to use
// JAWS as an ACE Service, as well.

int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
  ACE_Service_Config daemon;

  ACE_OS::signal (SIGCHLD, SIG_IGN);

  // SigAction not needed since the handler will shutdown the server.
  ACE_OS::signal (SIGINT, (ACE_SignalHandler) handler);
  ACE_OS::signal (SIGUSR2, (ACE_SignalHandler) handler);

  if (daemon.open (argc, argv, ACE_DEFAULT_LOGGER_KEY, 0) != 0)
    ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), 1);

  // The configured service creates threads, and the
  // server won't exit until the threads die.

  // Run forever, performing the configured services until we receive
  // a SIGINT.


  return 0;
}