3 //=============================================================================
7 * This is the definition of the sample NT Service class. This example
8 * only runs on Win32 platforms.
10 * @author Gonzalo Diethelm and Steve Huston
12 //=============================================================================
18 #include "ace/config-lite.h"
20 #if defined (ACE_WIN32) && !defined (ACE_LACKS_WIN32_SERVICES)
22 #include "ace/Event_Handler.h"
23 #include "ace/NT_Service.h"
24 #include "ace/Singleton.h"
25 #include "ace/Mutex.h"
27 class Service
: public ACE_NT_Service
34 /// We override <handle_control> because it handles stop requests
36 virtual void handle_control (DWORD control_code
);
38 /// We override <handle_exception> so a 'stop' control code can pop
39 /// the reactor off of its wait.
40 virtual int handle_exception (ACE_HANDLE h
);
42 /// This is a virtual method inherited from ACE_NT_Service.
45 /// Where the real work is done:
46 virtual int handle_timeout (const ACE_Time_Value
& tv
,
50 typedef ACE_NT_Service inherited
;
56 // Define a singleton class as a way to insure that there's only one
57 // Service instance in the program, and to protect against access from
58 // multiple threads. The first reference to it at runtime creates it,
59 // and the ACE_Object_Manager deletes it at run-down.
61 typedef ACE_Singleton
<Service
, ACE_Mutex
> SERVICE
;
63 #endif /* ACE_WIN32 && !ACE_LACKS_WIN32_SERVICES */
65 #endif /* #ifndef NTSVC_H_ */