summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-10-13 21:33:06 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-10-13 21:33:06 +0000
commitbe44626ef223feb12c91760ce639ce7ff93c58c3 (patch)
treee882d2989f8240a703f5f6fb793b2d974a13ed33 /tests
parent476c75ebc9348c4eb2374f6ba32107fbe5d13390 (diff)
downloadATCD-be44626ef223feb12c91760ce639ce7ff93c58c3.tar.gz
ChangeLogTag:Mon Oct 13 16:27:46 1997 Carlos O'Ryan <coryan@macarena.cs.wustl.edu>
Diffstat (limited to 'tests')
-rw-r--r--tests/Priority_Reactor_Test.cpp53
-rw-r--r--tests/Priority_Reactor_Test.h53
2 files changed, 42 insertions, 64 deletions
diff --git a/tests/Priority_Reactor_Test.cpp b/tests/Priority_Reactor_Test.cpp
index 1b1f6e8c25e..e42cf3f16df 100644
--- a/tests/Priority_Reactor_Test.cpp
+++ b/tests/Priority_Reactor_Test.cpp
@@ -37,37 +37,18 @@
#include "Priority_Reactor_Test.h"
static int opt_nchildren = 20;
-static int opt_nloops = 200;
-static int opt_priority_reactor = 1;
-
-class Read_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_SYNCH>
-// = TITLE
-// A Svc_Handler with a priority twist.
-//
-// = DESCRIPTION
-// This Svc_Handler receives the data sent by the childs or writer
-// threads; each one sets it own priority to a new level, in a
-// cyclic manner.
-// The main point is test and exercise the priority dispatching
-// features of ACE_Priority_Reactor.
-{
-public:
- static void set_countdown (int nchildren);
- // Set the number of children or writer threads we will be running,
- // when they are all gone we terminate the reactor loop.
+// The number of children to run, it can be changed using the -c
+// option.
- virtual int open (void *);
- virtual int handle_input (ACE_HANDLE h);
- // The Svc_Handler callbacks.
-
-private:
- static int waiting_;
- // How many writers are we waiting for.
+static int opt_nloops = 200;
+// The number of loops per children, it can be changed using the -l
+// option.
- static int started_;
- // How many readers have started.
-};
+static int opt_priority_reactor = 1;
+// If not set use the normal reactor, it can be changed using the -d
+// option.
+typedef ACE_Connector<Write_Handler, ACE_SOCK_CONNECTOR> CONNECTOR;
typedef ACE_Acceptor<Read_Handler, ACE_SOCK_ACCEPTOR> ACCEPTOR;
int Read_Handler::waiting_ = 0;
@@ -137,22 +118,6 @@ Read_Handler::handle_input (ACE_HANDLE h)
return 0;
}
-class Write_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_SYNCH>
-// = TITLE
-// A simple writer.
-//
-// = DESCRIPTION
-// This Svc_Handler simply connects to a server and sends some
-// output to it.
-// Its purpose is to feed the test.
-{
-public:
- virtual int open (void *);
- virtual int svc (void);
-};
-
-typedef ACE_Connector<Write_Handler, ACE_SOCK_CONNECTOR> CONNECTOR;
-
int
Write_Handler::open (void *)
{
diff --git a/tests/Priority_Reactor_Test.h b/tests/Priority_Reactor_Test.h
index 43c4d3b556d..900dbc73375 100644
--- a/tests/Priority_Reactor_Test.h
+++ b/tests/Priority_Reactor_Test.h
@@ -24,33 +24,46 @@
#include "ace/Service_Config.h"
#include "ace/Svc_Handler.h"
-class Svc_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
- // = TITLE
- // This class is the product created by both <ACE_Connector>
- // and <ACE_Acceptor> objects.
- //
- // = DESCRIPTION
- // This class gets its own header file to work around AIX C++
- // compiler "features" related to template instantiation... It is
- // only used by Conn_Test.cpp.
- // Basically it will run as an active object on the clients,
- // sending an stream of data to the server, where they will be
- // demultiplexed using a reactive strategy.
+class Read_Handler : public ACE_Svc_Handler<ACE_SOCK_Stream, ACE_INET_Addr, ACE_SYNCH>
+// = TITLE
+// A Svc_Handler with a priority twist.
+//
+// = DESCRIPTION
+// This Svc_Handler receives the data sent by the childs or writer
+// threads; each one sets it own priority to a new level, in a
+// cyclic manner.
+// The main point is test and exercise the priority dispatching
+// features of ACE_Priority_Reactor.
{
public:
- Svc_Handler (ACE_Thread_Manager * = 0);
- // Do-nothing constructor.
+ static void set_countdown (int nchildren);
+ // Set the number of children or writer threads we will be running,
+ // when they are all gone we terminate the reactor loop.
virtual int open (void *);
- // Initialization hook.
+ virtual int handle_input (ACE_HANDLE h);
+ // The Svc_Handler callbacks.
- void send_data (void);
- // Send data to server.
+private:
+ static int waiting_;
+ // How many writers are we waiting for.
- virtual int handle_input(ACE_HANDLE handle);
- // Recv data from client.
+ static int started_;
+ // How many readers have started.
+};
-private:
+class Write_Handler : public ACE_Svc_Handler<ACE_SOCK_Stream, ACE_INET_Addr, ACE_SYNCH>
+// = TITLE
+// A simple writer.
+//
+// = DESCRIPTION
+// This Svc_Handler simply connects to a server and sends some
+// output to it.
+// Its purpose is to feed the test.
+{
+public:
+ virtual int open (void *);
+ virtual int svc (void);
};
#endif /* ACE_TESTS_PRIORITY_REACTOR_TEST_H */