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