summaryrefslogtreecommitdiff
path: root/ace/Service_Main.cpp
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1996-11-27 06:04:10 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1996-11-27 06:04:10 +0000
commitc08f68e92f2454a46ec91db97d776ad6304328bb (patch)
treea53c24ee44d6b4fb4c6bb2d8e3168b987eb9f08b /ace/Service_Main.cpp
parent8d87d701900caa1f26567a5c639aa2c244fa1eeb (diff)
downloadATCD-c08f68e92f2454a46ec91db97d776ad6304328bb.tar.gz
foo
Diffstat (limited to 'ace/Service_Main.cpp')
-rw-r--r--ace/Service_Main.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/ace/Service_Main.cpp b/ace/Service_Main.cpp
index cf20fe799e8..f6d4ea1a4df 100644
--- a/ace/Service_Main.cpp
+++ b/ace/Service_Main.cpp
@@ -1,37 +1,33 @@
// Service_Main.cpp
// $Id$
-/* This is an example of a canonical Service Configurator daemon's
- main() function. Note how this driver file is completely generic
- and may be used to configure almost any type of network daemon. */
+// This is an example of a canonical Service Configurator daemon's
+// main() function. Note how this driver file is completely generic
+// and may be used to configure almost any type of network daemon.
#define ACE_BUILD_DLL
#include "ace/Service_Config.h"
-sig_atomic_t finished = 0;
-
-static void
-handler (int)
-{
- ACE_TRACE ("handler");
- finished = 1;
-}
-
int
sc_main (int argc, char *argv[])
{
ACE_TRACE ("sc_main");
ACE_Service_Config daemon;
- ACE_OS::signal (SIGINT, ACE_SignalHandler (handler));
-
if (daemon.open (argc, argv) == -1)
ACE_ERROR ((LM_ERROR, "%p\n%a", "open", 1));
- /* Run forever, performing the configured services. */
+ // Create an adapter to end the event loop.
+ ACE_Sig_Adapter sa (ACE_Sig_Handler_Ex (ACE_Service_Config::end_reactor_event_loop));
+
+ // Register a signal handler.
+ ACE_Service_Config::reactor ()->register_handler (SIGINT, sa);
+
+ // Run forever, performing the configured services until we are shut
+ // down by a SIGINT/SIGQUIT signal.
- while (!finished)
- daemon.run_reactor_event_loop ();
+ while (server_test.reactor_event_loop_done () == 0)
+ server_test.run_reactor_event_loop ();
return 0;
}