This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bash/cmd CTRL-C problem...


> For the record, here is a very simple java test program that I sent to
Troy when
> we discussed this problem last November. This program simply intercepts
CTL-C
> and runs a shutdown hook prior to shutting down the Java VM. It works fine
under
> cmd.exe and cygwin ash, but does not work under cygwin bash.

In my test case (myclass.java) I also added a shutdown hook but this app is
spawned as a child process from signals.exe with the CREATE_PROCESS_GROUP
flag enabled. This causes the Win32 kernel to call SetConsoleCtrlHandler on
behalf of the CreateProcess call and disable the CTRL-C handler (See the
MSDN entry for CreateProcess). Therefore child apps can only be killed  by
sending a CTRL-BREAK event. The effect on this is that the VM does not call
the shutdown hooks (And you have to call java with the -Xrs parameter
otherwise you will see just a thread dump of your child process)....

So I see your problem. We are currently not using any Shutdown hooks in our
Java services, but I suspect that we might be in the future and then we will
run into the same troubles you are facing today...

So I'm definitely interested in a solution of your problem as well....

Michael



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]