Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / ntp / libntp / mexit.c
1 /*
2  * mexit - Used to exit the NTPD daemon
3  * 
4  */
5
6 #ifdef SYS_WINNT
7 #include <stdio.h>
8 #include <windows.h>
9
10 HANDLE hServDoneEvent = NULL;
11
12 void
13 service_exit(
14         int status
15         )
16 {
17         extern int debug;
18
19         if (debug) /* did not become a service, simply exit */
20             ExitThread((DWORD)status);
21         else {
22                 /* service mode, need to have the service_main routine
23                  * register with the service control manager that the 
24                  * service has stopped running, before exiting
25                  */
26                 if ((status > 0) && (hServDoneEvent != NULL))
27                     SetEvent(hServDoneEvent);
28                 ExitThread((DWORD)status);
29         }
30 }
31
32 #else /* not SYS_WINNT */
33 int mexit_bs;
34 #endif /* not SYS_WINNT */
35 /*
36  * mexit - Used to exit the NTPD daemon
37  * 
38  */
39
40 #ifdef SYS_WINNT
41 #include <stdio.h>
42 #include <windows.h>
43
44 HANDLE hServDoneEvent = NULL;
45
46 void
47 service_exit(
48         int status
49         )
50 {
51         extern int debug;
52
53         if (debug) /* did not become a service, simply exit */
54             ExitThread((DWORD)status);
55         else {
56                 /* service mode, need to have the service_main routine
57                  * register with the service control manager that the 
58                  * service has stopped running, before exiting
59                  */
60                 if ((status > 0) && (hServDoneEvent != NULL))
61                     SetEvent(hServDoneEvent);
62                 ExitThread((DWORD)status);
63         }
64 }
65
66 #else /* not SYS_WINNT */
67 int mexit_bs;
68 #endif /* not SYS_WINNT */