1 // The main test driver for the dynamically configured server.
3 #include "ace/OS_NS_unistd.h"
4 #include "ace/Service_Config.h"
5 #include "ace/Reactor.h"
6 #include "ace/Log_Msg.h"
7 #include "ace/Signal.h"
8 #include "ace/Sig_Adapter.h"
11 ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
13 if (ACE_Service_Config::open (argc
,
15 ACE_DEFAULT_LOGGER_KEY
,
17 ACE_ERROR_RETURN ((LM_ERROR
,
19 ACE_TEXT ("ACE_Service_Config::open")),
22 // Create an adapter to end the event loop.
23 ACE_Sig_Adapter
sa ((ACE_Sig_Handler_Ex
) ACE_Reactor::end_event_loop
);
26 sig_set
.sig_add (SIGINT
);
27 sig_set
.sig_add (SIGQUIT
);
29 // Register ourselves to receive signals so we can shut down
31 if (ACE_Reactor::instance ()->register_handler (sig_set
,
33 ACE_ERROR_RETURN ((LM_ERROR
,
34 ACE_TEXT ("%p\n"), ACE_TEXT ("register_handler")),
37 // This makes the README demo even easier (for sighup).
39 ACE_TEXT ("pid = %d\n"),
42 // Run forever, performing the configured services until we are shut
43 // down by a SIGINT/SIGQUIT signal.
45 // We use this version of the event loop so that reconfigurations
46 // are triggered properly.
47 ACE_Reactor::run_event_loop ();