aboutsummaryrefslogtreecommitdiff
path: root/contrib/ntp/libntp/mexit.c
blob: 6ae452ef373092157af1617a6165b718455004e1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * mexit - Used to exit the NTPD daemon
 * 
 */

#ifdef SYS_WINNT
#include <stdio.h>
#include <windows.h>

HANDLE hServDoneEvent = NULL;

void
service_exit(
	int status
	)
{
	extern int debug;

	if (debug) /* did not become a service, simply exit */
	    ExitThread((DWORD)status);
	else {
		/* service mode, need to have the service_main routine
		 * register with the service control manager that the 
		 * service has stopped running, before exiting
		 */
		if ((status > 0) && (hServDoneEvent != NULL))
		    SetEvent(hServDoneEvent);
		ExitThread((DWORD)status);
	}
}

#else /* not SYS_WINNT */
int mexit_bs;
#endif /* not SYS_WINNT */