2 //=============================================================================
4 * @file Priority_Reactor_Test.h
6 * It is only used by Priority_Reactor_Test.cpp.
8 * @author Carlos O'Ryan <coryan@cs.wustl.edu>
10 //=============================================================================
13 #ifndef ACE_TESTS_PRIORITY_REACTOR_TEST_H
14 #define ACE_TESTS_PRIORITY_REACTOR_TEST_H
16 #include "ace/Service_Config.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "ace/SOCK_Stream.h"
23 #include "ace/Svc_Handler.h"
28 * @brief A Svc_Handler with a priority twist.
30 * This Svc_Handler receives the data sent by the childs or writer
31 * threads; each one sets it own priority to a new level, in a
32 * cyclic manner. The main point is test and exercise the
33 * priority dispatching features of ACE_Priority_Reactor.
35 class Read_Handler
: public ACE_Svc_Handler
<ACE_SOCK_STREAM
, ACE_SYNCH
>
38 /// Set the number of children or writer threads we will be running,
39 /// when they are all gone we terminate the reactor loop.
40 static void set_countdown (int nchildren
);
42 /// Get the number of children we are still waiting for.
43 static int get_countdown ();
45 /// The Svc_Handler callbacks.
46 virtual int open (void *);
47 virtual int handle_input (ACE_HANDLE h
);
50 /// How many writers are we waiting for.
53 /// How many readers have started.
58 * @class Write_Handler
60 * @brief A simple writer.
62 * This Svc_Handler simply connects to a server and sends some
63 * output to it. Its purpose is to feed the test.
65 class Write_Handler
: public ACE_Svc_Handler
<ACE_SOCK_STREAM
, ACE_SYNCH
>
68 virtual int open (void *);
72 #endif /* ACE_TESTS_PRIORITY_REACTOR_TEST_H */