summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1998-10-12 22:10:19 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1998-10-12 22:10:19 +0000
commit65ebe8d55823b88b33291566ad7b19255d4e7fd6 (patch)
tree18fda80561a61ee4e75b689c5e45e10cc73b223d /examples
parent8df2c1474a046ebcec03bc2cdda6185723293635 (diff)
downloadATCD-65ebe8d55823b88b33291566ad7b19255d4e7fd6.tar.gz
.
Diffstat (limited to 'examples')
-rw-r--r--examples/ASX/CCM_App/CCM_App.cpp36
-rw-r--r--examples/ASX/CCM_App/SC_Server.cpp32
-rw-r--r--examples/ASX/CCM_App/svc.conf22
3 files changed, 57 insertions, 33 deletions
diff --git a/examples/ASX/CCM_App/CCM_App.cpp b/examples/ASX/CCM_App/CCM_App.cpp
index 33950fc4015..6ec3f4dd822 100644
--- a/examples/ASX/CCM_App/CCM_App.cpp
+++ b/examples/ASX/CCM_App/CCM_App.cpp
@@ -26,35 +26,45 @@ public:
int
Test_Task::open (void *)
{
- ACE_DEBUG ((LM_DEBUG, "opening %s\n", this->name () ? this->name () : "task"));
+ ACE_DEBUG ((LM_DEBUG,
+ "opening %s\n",
+ this->name () ? this->name () : "task"));
return 0;
}
int
Test_Task::close (u_long)
{
- ACE_DEBUG ((LM_DEBUG, "closing %s\n", this->name () ? this->name () : "task"));
+ ACE_DEBUG ((LM_DEBUG,
+ "closing %s\n",
+ this->name () ? this->name () : "task"));
return 0;
}
int
Test_Task::suspend (void)
{
- ACE_DEBUG ((LM_DEBUG, "suspending in %s\n", this->name () ? this->name () : "task"));
+ ACE_DEBUG ((LM_DEBUG,
+ "suspending in %s\n",
+ this->name () ? this->name () : "task"));
return 0;
}
int
Test_Task::resume (void)
{
- ACE_DEBUG ((LM_DEBUG, "resuming in %s\n", this->name () ? this->name () : "task"));
+ ACE_DEBUG ((LM_DEBUG,
+ "resuming in %s\n",
+ this->name () ? this->name () : "task"));
return 0;
}
int
Test_Task::init (int, char *[])
{
- ACE_DEBUG ((LM_DEBUG, "initializing %s\n", this->name () ? this->name () : "task"));
+ ACE_DEBUG ((LM_DEBUG,
+ "initializing %s\n",
+ this->name () ? this->name () : "task"));
return 0;
}
@@ -62,23 +72,23 @@ Test_Task::init (int, char *[])
int
Test_Task::fini (void)
{
- ACE_DEBUG ((LM_DEBUG, "finalizing %s\n", this->name () ? this->name () : "task"));
+ ACE_DEBUG ((LM_DEBUG,
+ "finalizing %s\n",
+ this->name () ? this->name () : "task"));
return 0;
}
+// Factories used to control configuration.
+
+ACE_SVC_FACTORY_DECLARE (Test_Task)
+ACE_SVC_FACTORY_DEFINE (Test_Task)
+
// Dynamically linked functions used to control configuration.
extern "C" ACE_Svc_Export MT_Stream *make_stream (void);
extern "C" ACE_Svc_Export MT_Module *make_da (void);
extern "C" ACE_Svc_Export MT_Module *make_ea (void);
extern "C" ACE_Svc_Export MT_Module *make_mr (void);
-extern "C" ACE_Svc_Export ACE_Service_Object *make_task (void);
-
-ACE_Service_Object *
-make_task (void)
-{
- return new Test_Task;
-}
MT_Stream *
make_stream (void)
diff --git a/examples/ASX/CCM_App/SC_Server.cpp b/examples/ASX/CCM_App/SC_Server.cpp
index 189a46ab98c..25ec26b41b0 100644
--- a/examples/ASX/CCM_App/SC_Server.cpp
+++ b/examples/ASX/CCM_App/SC_Server.cpp
@@ -1,6 +1,7 @@
// $Id$
-// Simple driver program for the server.
+// Simple driver program for the server. This driver dynamically
+// links in all the services in the <svc.conf> file.
#include "ace/Service_Config.h"
#include "ace/Thread_Manager.h"
@@ -21,13 +22,18 @@ int
Event_Handler::handle_input (ACE_HANDLE handle)
{
char buf[BUFSIZ];
-
ssize_t n = ACE_OS::read (handle, buf, sizeof buf);
if (n == -1)
return -1;
+ else if (n == 0)
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ "shutting down on EOF\n"),
+ -1);
else if (ACE_OS::write (ACE_STDOUT, buf, n) != n)
- return -1;
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ "%p\n", "write failed"),
+ -1);
else
return 0;
}
@@ -35,7 +41,9 @@ Event_Handler::handle_input (ACE_HANDLE handle)
int
Event_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask)
{
- ACE_DEBUG ((LM_DEBUG, "closing Event_Handler\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "closing Event_Handler\n"));
+ ACE_Reactor::end_event_loop ();
return 0;
}
@@ -49,18 +57,24 @@ main (int argc, char *argv[])
if (ACE_Event_Handler::register_stdin_handler (&handler,
ACE_Reactor::instance (),
ACE_Thread_Manager::instance ()) == -1)
- ACE_ERROR ((LM_ERROR, "%p\n", "register_stdin_handler"));
+ ACE_ERROR ((LM_ERROR,
+ "%p\n",
+ "register_stdin_handler"));
if (loggerd.open (argc, argv) == -1 && errno != ENOENT)
- ACE_ERROR ((LM_ERROR, "%p\n%a", "open", 1));
-
+ ACE_ERROR ((LM_ERROR,
+ "%p\n%a",
+ "open",
+ 1));
else if (ACE_Reactor::instance ()->register_handler
(SIGINT, &shutdown_handler) == -1)
- ACE_ERROR ((LM_ERROR, "%p\n%a", "register_handler", 1));
+ ACE_ERROR ((LM_ERROR,
+ "%p\n%a",
+ "register_handler",
+ 1));
// Perform logging service until we receive SIGINT.
ACE_Reactor::run_event_loop ();
-
return 0;
}
diff --git a/examples/ASX/CCM_App/svc.conf b/examples/ASX/CCM_App/svc.conf
index f77d9b14d9d..b894e6e69e5 100644
--- a/examples/ASX/CCM_App/svc.conf
+++ b/examples/ASX/CCM_App/svc.conf
@@ -1,21 +1,21 @@
static ACE_Service_Manager "-d -p 4911"
-dynamic My_Task Service_Object *.shobj/CCM_App:make_task() "-p 3000"
+dynamic Test_Task Service_Object *CCM_App:_make_Test_Task() "-p 3000"
-stream dynamic CCM_App STREAM *.shobj/CCM_App:make_stream() active
+stream dynamic CCM_App STREAM *CCM_App:make_stream() active
{
- dynamic Device_Adapter Module *.shobj/CCM_App:make_da()
- dynamic Event_Analyzer Module *.shobj/CCM_App:make_ea()
- dynamic Multicast_Router Module *.shobj/CCM_App:make_mr() "-p 3001"
+ dynamic Device_Adapter Module *CCM_App:make_da()
+ dynamic Event_Analyzer Module *CCM_App:make_ea()
+ dynamic Multicast_Router Module *CCM_App:make_mr() "-p 3001"
}
-
+
stream CCM_App
{
remove Device_Adapter
- remove Event_Analyzer
- remove Multicast_Router
+# remove Event_Analyzer
+# remove Multicast_Router
}
-
-remove CCM_App
-remove My_Task
+
+# remove CCM_App
+remove Test_Task