1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2009 Index Data
3 * See the file LICENSE for details.
8 * \brief Small test for the Windows Service Control utility
19 #include <yaz/xmalloc.h>
23 /** \brief handle that is used to stop that service should be stopped */
24 HANDLE default_stop_event = NULL;
26 /** \brief stop handler which just signals "stop" */
27 static void default_sc_stop(yaz_sc_t s)
29 SetEvent(default_stop_event);
32 /** \brief service control main
33 This does not read argc and argv.
34 Real applications would typically do that. It is very important that
35 yaz_sc_running is called before the application starts to operate .
37 static int default_sc_main(yaz_sc_t s, int argc, char **argv)
39 default_stop_event = CreateEvent(
40 NULL, // default security attributes
41 TRUE, // manual reset event
42 FALSE, // not signaled
45 if (default_stop_event == NULL)
50 WaitForSingleObject(default_stop_event, INFINITE);
54 /** \brief the system main function */
55 int main(int argc, char **argv)
57 yaz_sc_t s = yaz_sc_create("yaz_sc_test", "YAZ Service Control Test");
59 yaz_sc_program(s, argc, argv, default_sc_main, default_sc_stop);
67 * c-file-style: "Stroustrup"
68 * indent-tabs-mode: nil
70 * vim: shiftwidth=4 tabstop=8 expandtab