00001 /* -*- C++ -*- */ 00002 //============================================================================= 00003 /** 00004 * @file Activator_NT_Service.h 00005 * 00006 * Activator_NT_Service.h,v 1.5 2005/05/27 20:33:55 michel_j Exp 00007 * 00008 * @author Darrell Brunsch <brunsch@cs.wustl.edu> 00009 * @author Jeff Parsons <parsons@cs.wustl.edu> 00010 * @author John Tucker <jtucker@infoglide.com> 00011 * @author Mike Vitalo <mvitalo@infoglide.com> 00012 */ 00013 //============================================================================= 00014 00015 #ifndef Activator_NT_Service_H 00016 #define Activator_NT_Service_H 00017 00018 #include "ace/config-all.h" 00019 00020 #if defined (ACE_WIN32) 00021 00022 #include "ace/NT_Service.h" 00023 #include "ace/Singleton.h" 00024 #include "ace/Synch.h" 00025 #include "tao/orbconf.h" 00026 00027 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00028 # pragma once 00029 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00030 00031 static const char * IMR_ACTIVATOR_SERVICE_NAME = "TAOImRActivator"; 00032 static const char * IMR_ACTIVATOR_DISPLAY_NAME = "TAO Implementation Repository Activator"; 00033 static const char * IMR_ACTIVATOR_DESCRIPTION = "Implementation Repository Activator service for TAO"; 00034 00035 /** 00036 * @class Activator_NT_Service 00037 * 00038 * @brief Allows the Implementation Repository to act as a Windows NT Service. 00039 */ 00040 class Activator_NT_Service : public ACE_NT_Service 00041 { 00042 public: 00043 typedef TAO_SYNCH_RECURSIVE_MUTEX MUTEX; 00044 00045 /// We override <handle_control> because it handles stop requests 00046 /// privately. 00047 virtual void handle_control (DWORD control_code); 00048 00049 /// We override <handle_exception> so a 'stop' control code can wake 00050 /// the reactor off of its wait. 00051 virtual int handle_exception (ACE_HANDLE h); 00052 00053 /// This is a virtual method inherited from ACE_NT_Service. 00054 virtual int svc (void); 00055 private: 00056 friend class ACE_Singleton<Activator_NT_Service, MUTEX>; 00057 }; 00058 00059 typedef ACE_Singleton<Activator_NT_Service, ACE_Mutex> SERVICE; 00060 00061 #endif /* ACE_WIN32 */ 00062 00063 #endif /* Activator_NT_Service_H */ 00064 00065