1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2010 Index Data
3 * See the file LICENSE for details.
8 * \brief Small test for the Windows Service Control utility
20 #include <yaz/xmalloc.h>
26 /** \brief handle that is used to stop that service should be stopped */
27 HANDLE default_stop_event = NULL;
29 /** \brief stop handler which just signals "stop" */
30 static void default_sc_stop(yaz_sc_t s)
32 SetEvent(default_stop_event);
35 /** \brief service control main
36 This does not read argc and argv.
37 Real applications would typically do that. It is very important that
38 yaz_sc_running is called before the application starts to operate .
40 static int default_sc_main(yaz_sc_t s, int argc, char **argv)
42 default_stop_event = CreateEvent(
43 NULL, // default security attributes
44 TRUE, // manual reset event
45 FALSE, // not signaled
48 if (default_stop_event == NULL)
53 WaitForSingleObject(default_stop_event, INFINITE);
59 /** \brief the system main function */
60 int main(int argc, char **argv)
63 yaz_sc_t s = yaz_sc_create("yaz_sc_test", "YAZ Service Control Test");
65 yaz_sc_program(s, argc, argv, default_sc_main, default_sc_stop);
69 printf("Only on Windows\n");
76 * c-file-style: "Stroustrup"
77 * indent-tabs-mode: nil
79 * vim: shiftwidth=4 tabstop=8 expandtab