Subject: Signal Handling of CYGWIN under VMware Workstation
From: Thomas Kloeber <[email-masked]>
To: [email-masked]
Date: Wed, 26 May 2004 16:20:59 +0200

Folks'es,

i'm using cygwin 1.5.9-1 on Windows NT 4SP6 and W2K, both of which run 
on top of VMware Workstation 4.5.1 (host system is W2K on a Dell 
Precision 340).

i have a problem with a database application server (a port from Unix 
using cygwin): if i shut down the application from a bash/ksh via CTRL+C 
the application receives the signal but, instead of performing its 
shutdown procedure, the process dissappears immediately, leaving my DB 
in an inconsitent state. if i do the same from a DOS cmd, the server 
process shuts down ok.

i see the same behaviour if i shutdown the process via a 'control 
panel', which sends the server process a SIGTERM, in 2 out of 3 cases 
the process stops immediately without performing its proper shutdown.

however, if i run the application incl cygwin on a native system, 
everything works just fine.

so my question is, what is the connection/difference between VMware and 
Cygwin signal handling?

thomas

i have written a little test program which demonstrates the behaviour. 
if i run it in a ksh and hit CRTL+C, the process receives the signal and 
terminates. if i run it in DOS cmd, the process receives the signal, 
does its count down and then terminates:

#include "stdafx.h"
#include "signal.h"
#include <windows.h>
#include <stdio.h>

void goHome(int s)
{
    printf("Received signal %d\n", s);
    for (int i = 10; i > 0; i--) {
        printf("Need %2d more seconds to terminate\r", i);
        Sleep(1000L);
    }
    exit(0);
}

int
main(int argc, char *argv[])
{
    signal(SIGINT, goHome);

    printf("Hit Ctrl+C to terminate me\n");
    while (1) {
        Sleep(1000);
    }

    return 0;
}

-- 
It has never been easier to help someone who suffers from hunger,
and use the web for a good purpose: http://www.thehungersite.com/

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/