diff options
Diffstat (limited to 'examples/Service_Configurator/Misc')
-rw-r--r-- | examples/Service_Configurator/Misc/Makefile | 96 | ||||
-rw-r--r-- | examples/Service_Configurator/Misc/Timer_Service.cpp | 92 | ||||
-rw-r--r-- | examples/Service_Configurator/Misc/Timer_Service.h | 34 | ||||
-rw-r--r-- | examples/Service_Configurator/Misc/main.cpp | 24 | ||||
-rw-r--r-- | examples/Service_Configurator/Misc/svc.conf | 6 |
5 files changed, 0 insertions, 252 deletions
diff --git a/examples/Service_Configurator/Misc/Makefile b/examples/Service_Configurator/Misc/Makefile deleted file mode 100644 index 218c8873355..00000000000 --- a/examples/Service_Configurator/Misc/Makefile +++ /dev/null @@ -1,96 +0,0 @@ -#---------------------------------------------------------------------------- -# -# $Id$ -# -# Makefile for a test of the miscellaneous Service_Config examples -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Local macros -#---------------------------------------------------------------------------- - -BIN = main - -FILES = Timer_Service - -LSRC = $(addsuffix .cpp,$(FILES)) -LOBJ = $(addsuffix .o,$(FILES)) -SHOBJ = $(addsuffix .so,$(FILES)) - -BUILD = $(VBIN) - -#---------------------------------------------------------------------------- -# Include macros and targets -#---------------------------------------------------------------------------- - -include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU -include $(ACE_ROOT)/include/makeinclude/macros.GNU -include $(ACE_ROOT)/include/makeinclude/rules.common.GNU -include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU -include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU -include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU -include $(ACE_ROOT)/include/makeinclude/rules.local.GNU - -#---------------------------------------------------------------------------- -# Local targets -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Dependencies -#---------------------------------------------------------------------------- -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - -.obj/Timer_Service.o .shobj/Timer_Service.so: Timer_Service.cpp Timer_Service.h \ - $(ACE_ROOT)/ace/Service_Config.h \ - $(ACE_ROOT)/ace/Service_Object.h \ - $(ACE_ROOT)/ace/Shared_Object.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/config.h \ - $(ACE_ROOT)/ace/iosfwd.h \ - $(ACE_ROOT)/ace/OS.i \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/Log_Msg.h \ - $(ACE_ROOT)/ace/Log_Record.h \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Shared_Object.i \ - $(ACE_ROOT)/ace/Event_Handler.h \ - $(ACE_ROOT)/ace/Event_Handler.i \ - $(ACE_ROOT)/ace/Service_Object.i \ - $(ACE_ROOT)/ace/Signal.h \ - $(ACE_ROOT)/ace/Synch.h \ - $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ - $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ - $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ - $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ - $(ACE_ROOT)/ace/Synch.i \ - $(ACE_ROOT)/ace/Synch_T.h \ - $(ACE_ROOT)/ace/Synch_T.i \ - $(ACE_ROOT)/ace/Thread.h \ - $(ACE_ROOT)/ace/Thread.i \ - $(ACE_ROOT)/ace/Atomic_Op.i \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Signal.i \ - $(ACE_ROOT)/ace/Object_Manager.h \ - $(ACE_ROOT)/ace/Object_Manager.i \ - $(ACE_ROOT)/ace/Managed_Object.h \ - $(ACE_ROOT)/ace/Managed_Object.i \ - $(ACE_ROOT)/ace/Service_Config.i \ - $(ACE_ROOT)/ace/Reactor.h \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Timer_Queue.h \ - $(ACE_ROOT)/ace/Timer_Queue_T.h \ - $(ACE_ROOT)/ace/Free_List.h \ - $(ACE_ROOT)/ace/Free_List.i \ - $(ACE_ROOT)/ace/Timer_Queue_T.i \ - $(ACE_ROOT)/ace/Reactor.i \ - $(ACE_ROOT)/ace/Reactor_Impl.h \ - $(ACE_ROOT)/ace/Svc_Conf_Tokens.h - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/examples/Service_Configurator/Misc/Timer_Service.cpp b/examples/Service_Configurator/Misc/Timer_Service.cpp deleted file mode 100644 index f244f74eaa2..00000000000 --- a/examples/Service_Configurator/Misc/Timer_Service.cpp +++ /dev/null @@ -1,92 +0,0 @@ -// $Id$ - -#include "Timer_Service.h" - -int -Timer_Service::init (int argc, char *argv[]) -{ - ACE_DEBUG ((LM_DEBUG, - "in Timer_Service::init, argv[0] = %s, argc == %d\n", - argv[0], argc)); - - for (int i = 0; i < argc; i++) - ACE_DEBUG ((LM_DEBUG, "argv[%d] = %s\n", i, argv[i])); - - int interval = Timer_Service::TIMEOUT; - - if (argc > 1) - { - // If the second argument exists use this as the interval for - // the periodic timer. Otherwise, go off every TIMEOUT seconds. - - interval = ACE_OS::atoi (argv[1]); - - if (interval == 0) - interval = Timer_Service::TIMEOUT; - } - - if (argc > 2) - { - // If the third argument exists use it to control the maximum - // number of timeouts. - this->max_timeouts_ = ACE_OS::atoi (argv[2]); - - if (this->max_timeouts_ == 0) - this->max_timeouts_ = Timer_Service::MAX_TIMEOUTS; - } - - this->cur_timeouts_ = 0; - - // If the fourth argument exists take this as an indication to - // enable tracing. - if (argc > 3) - ACE_Trace::start_tracing (); - else - ACE_Trace::stop_tracing (); - - // Register the timer to go off in 1 second, and then to go off - // every <interval> seconds. - if (ACE_Reactor::instance ()->schedule_timer - (this, 0, ACE_Time_Value (1), ACE_Time_Value (interval)) == -1) - return -1; - else - return 0; -} - -int -Timer_Service::handle_timeout (const ACE_Time_Value &tv, - const void *) -{ - ACE_DEBUG ((LM_DEBUG, - "in Timer_Service::handle_timeout sec = %d, usec = %d" - " cur_timeouts = %d, max_timeouts = %d\n", - tv.sec (), tv.usec (), - this->cur_timeouts_, this->max_timeouts_)); - - this->cur_timeouts_++; - - if (this->cur_timeouts_ == this->max_timeouts_) - // Shutdown the test. - return -1; - else - return 0; -} - -int -Timer_Service::handle_close (ACE_HANDLE, - ACE_Reactor_Mask) -{ - ACE_DEBUG ((LM_DEBUG, "closing down the timer test\n")); - - ACE_Reactor::end_event_loop(); - return 0; -} - -// Define the factory function. -ACE_SVC_FACTORY_DEFINE (Timer_Service) - -// Define the object that describes the service. -ACE_STATIC_SVC_DEFINE (Timer_Service, - "Timer_Service", ACE_SVC_OBJ_T, &ACE_SVC_NAME (Timer_Service), - ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, 0) - diff --git a/examples/Service_Configurator/Misc/Timer_Service.h b/examples/Service_Configurator/Misc/Timer_Service.h deleted file mode 100644 index 2166dbbe22e..00000000000 --- a/examples/Service_Configurator/Misc/Timer_Service.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#include "ace/Service_Config.h" - -class Timer_Service : public ACE_Service_Object -{ -public: - virtual int init (int argc, char *argv[]); - // Initialization hook. - - virtual int handle_timeout (const ACE_Time_Value &, - const void *); - // Timeout hook. - - virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask); - // Close hook. - -private: - enum - { - TIMEOUT = 4, // Wait 4 seconds between timeouts - MAX_TIMEOUTS = 10 // Don't timeout for more than 10 times. - }; - - int max_timeouts_; - // Maximum number of timeouts before shutting down the test. - - int cur_timeouts_; - // Current number of timeouts. -}; - -ACE_STATIC_SVC_DECLARE (Timer_Service) - diff --git a/examples/Service_Configurator/Misc/main.cpp b/examples/Service_Configurator/Misc/main.cpp deleted file mode 100644 index f898ae8b974..00000000000 --- a/examples/Service_Configurator/Misc/main.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// $Id$ - -#include "ace/Service_Config.h" -#include "Timer_Service.h" - -// Create an object that will insert the Timer_Service into the list -// of statically linked services that the ACE_Service_Config will -// process at run-time. -ACE_STATIC_SVC_REQUIRE(Timer_Service) - -int -main (int argc, char *argv[]) -{ - ACE_Service_Config daemon; - - if (daemon.open (argc, argv) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), 1); - - // Run forever, performing the configured services until we receive - // a SIGINT. - - ACE_Reactor::run_event_loop (); - return 0; -} diff --git a/examples/Service_Configurator/Misc/svc.conf b/examples/Service_Configurator/Misc/svc.conf deleted file mode 100644 index e1a6070ccc8..00000000000 --- a/examples/Service_Configurator/Misc/svc.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Statically configure the Timer_Service into the application process -# and pass in up to 4 arguments. The final 3 arguments are retrieved from -# environment variables, so they can be set by changing your -# environment before running the main program. If you don't have -# these variables set they are ignored. -static Timer_Service "timer $INTERVAL $MAX_TIMEOUTS $TRACE" |