(main,print_usage) [_WIN32]: Add the ability to enable

empire thread debugging for Windows build.

(empth_select) [_WIN32]: Fix empth_select() so can be aborted.
The bug was that a command would not be aborted during an update.
The problem was select() was not interrupt by the setting of the
signalling wakeup event.  Fix by replacing the select() with
WSAEventSelect().

(empth_exit) [_WIN32]:
Fix the shutdown sequence for Windows build to be running in
empth_t context.  Add a loc_RunThisThread() in empth_exit()
before starting the shutdown() sequence.
This commit is contained in:
Ron Koenderink 2005-03-13 21:53:23 +00:00
parent 1f9b34dfdd
commit 1bbd7e5342
3 changed files with 49 additions and 74 deletions

View file

@ -87,14 +87,16 @@ static void
print_usage(char *program_name)
{
#if defined(_WIN32)
printf("Usage: %s -i -I service_name -r -R service_name -D datadir -e config_file -d\n", program_name);
printf("Usage: %s -i -I service_name -r -R service_name -D datadir -e config_file -d -p\n",
program_name);
printf("-i install service with the default name %s\n", DEFAULT_SERVICE_NAME);
printf("-r remove service with the default name %s\n", DEFAULT_SERVICE_NAME);
#else
printf("Usage: %s -D datadir -e config_file -d -p -s\n", program_name);
printf("-p print flag\n");
printf("-s stack check flag (include print flag)\n");
#endif
printf("-p print flag\n");
printf("-d debug mode\n");
}
@ -112,7 +114,7 @@ main(int argc, char **argv)
int op;
#if defined(_WIN32)
while ((op = getopt(argc, argv, "D:de:iI:rR:h")) != EOF) {
while ((op = getopt(argc, argv, "D:de:iI:rR:hp")) != EOF) {
#else
while ((op = getopt(argc, argv, "D:de:psh")) != EOF) {
#endif
@ -130,6 +132,10 @@ main(int argc, char **argv)
case 'e':
config_file = optarg;
break;
case 'p':
flags |= EMPTH_PRINT;
daemonize = 0;
break;
#if defined(_WIN32)
case 'I':
service_name = optarg;
@ -149,10 +155,6 @@ main(int argc, char **argv)
remove_service_set++;
break;
#else
case 'p':
flags |= EMPTH_PRINT;
daemonize = 0;
break;
case 's':
flags |= EMPTH_PRINT | EMPTH_STACKCHECK;
daemonize = 0;
@ -478,8 +480,10 @@ shutdwn(int sig)
finish_server();
#if defined(_WIN32)
if (daemonize)
if (daemonize) {
stop_service();
return;
}
#endif
_exit(0);
}