summaryrefslogtreecommitdiff
path: root/ace/Service_Main.cpp
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1996-10-21 21:41:34 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1996-10-21 21:41:34 +0000
commita5fdebc5f6375078ec1763850a4ca23ec7fe6458 (patch)
treebcf0a25c3d45a209a6e3ac37b233a4812f29c732 /ace/Service_Main.cpp
downloadATCD-a5fdebc5f6375078ec1763850a4ca23ec7fe6458.tar.gz
Initial revision
Diffstat (limited to 'ace/Service_Main.cpp')
-rw-r--r--ace/Service_Main.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/ace/Service_Main.cpp b/ace/Service_Main.cpp
new file mode 100644
index 00000000000..cf20fe799e8
--- /dev/null
+++ b/ace/Service_Main.cpp
@@ -0,0 +1,37 @@
+// 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. */
+
+#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. */
+
+ while (!finished)
+ daemon.run_reactor_event_loop ();
+
+ return 0;
+}