signal handler and JNI

Alex Dupre sysadmin@alexdupre.com
Mon Feb 20 14:47:00 GMT 2006


Hello,
I have a question about signal handling and JNI under cygwin.

The scenario is the following:
- a cygwin program register a function to handle SIGINT and SIGTERM signals
- the program then launches the Java Virtual Machine via the JNI 
invocation API, telling it to not override any signal handlers

Hitting a CTRL-C should then immediately run the defined signal handler, 
but this is not the case. For some reason (what exactly?) inside the 
java program I need to periodically call a native function linked with 
cygwin, but this is not enough. In the called function I have to do 
something more, like printing a char to stdout or /dev/null (calling 
printf("") with an empty string doesn't work). Only in this way the 
signal handler is called as soon as I hit CTRL-C, otherwise it's ignored 
or handled seconds/minutes later.
Maybe the callback to C code is mandatory under cygwin, but why should I 
print something to have to signal handled? Any suggestions?

-- 
Alex Dupre

--
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/



More information about the Cygwin mailing list