00001 /* -*- C++ -*- */ 00002 //============================================================================= 00003 /** 00004 * @file Locator_NT_Service.h 00005 * 00006 * Locator_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 Locator_NT_Service_H 00016 #define Locator_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 static const char * IMR_LOCATOR_SERVICE_NAME = "TAOImR"; 00028 static const char * IMR_LOCATOR_DISPLAY_NAME = "TAO Implementation Repository"; 00029 static const char * IMR_LOCATOR_DESCRIPTION = "Implementation Repository Locator service for TAO"; 00030 00031 /** 00032 * @class Locator_NT_Service 00033 * 00034 * @brief Allows the Implementation Repository to act as a Windows NT Service. 00035 */ 00036 class Locator_NT_Service : public ACE_NT_Service 00037 { 00038 public: 00039 typedef TAO_SYNCH_RECURSIVE_MUTEX MUTEX; 00040 00041 /// We override <handle_control> because it handles stop requests 00042 /// privately. 00043 virtual void handle_control (DWORD control_code); 00044 00045 /// We override <handle_exception> so a 'stop' control code can wake 00046 /// the reactor off of its wait. 00047 virtual int handle_exception (ACE_HANDLE h); 00048 00049 /// This is a virtual method inherited from ACE_NT_Service. 00050 virtual int svc (void); 00051 00052 private: 00053 friend class ACE_Singleton<Locator_NT_Service, MUTEX>; 00054 }; 00055 00056 typedef ACE_Singleton<Locator_NT_Service, ACE_Mutex> SERVICE; 00057 00058 #endif /* ACE_WIN32 */ 00059 00060 #endif /* Locator_NT_Service_H */ 00061 00062