diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:30 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:30 +0000 |
commit | c44379cc7d9c7aa113989237ab0f56db12aa5219 (patch) | |
tree | 66a84b20d47f2269d8bdc6e0323f338763424d3a /ACE/tests/Priority_Reactor_Test.h | |
parent | 3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c (diff) | |
download | ATCD-c44379cc7d9c7aa113989237ab0f56db12aa5219.tar.gz |
Repo restructuring
Diffstat (limited to 'ACE/tests/Priority_Reactor_Test.h')
-rw-r--r-- | ACE/tests/Priority_Reactor_Test.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/ACE/tests/Priority_Reactor_Test.h b/ACE/tests/Priority_Reactor_Test.h new file mode 100644 index 00000000000..fdf17865448 --- /dev/null +++ b/ACE/tests/Priority_Reactor_Test.h @@ -0,0 +1,76 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// tests +// +// = FILENAME +// Priority_Reactor_Test.h +// +// = DESCRIPTION +// This class gets its own header file to work around AIX C++ +// compiler "features" related to template instantiation... It is +// only used by Priority_Reactor_Test.cpp. +// +// = AUTHOR +// Carlos O'Ryan <coryan@cs.wustl.edu> +// +// ============================================================================ + +#ifndef ACE_TESTS_PRIORITY_REACTOR_TEST_H +#define ACE_TESTS_PRIORITY_REACTOR_TEST_H + +#include "ace/Service_Config.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/SOCK_Stream.h" +#include "ace/Svc_Handler.h" + +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. + + static int get_countdown (void); + // Get the number of children we are still waiting for. + + 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 started_; + // How many readers have started. +}; + +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); +}; + +#endif /* ACE_TESTS_PRIORITY_REACTOR_TEST_H */ |