Of course this isn't the correct approach. You've indicated several times that you know what the correct approach is. Fixing your suspend problems would probably be even better.
You are likely to have problems if a non-masked thread in your JVM receives the SIGINT instead. This can happen if you are using a shared JVM between processes. If you completely control the environment, this is avoidable.
This is a kludge. It works, but it's a kludge.
Now if you want to avoid Java altogether, you should look at CPAN.
Updated (OT): Here's the Java code you would need to have your apps handle a Ctrl-C gracefully:
class ExampleShutdownHook { public static void main(String[] args) { // Java code to install shutdown hook: MyShutdown MyShutdown sh = new MyShutdown(); Runtime.getRuntime().addShutdownHook(sh); // Do the Joone stuff // . // . // . } } // Example shutdown hook class class MyShutdown extends Thread { public void run() { System.out.println("MyShutdown hook called"); // Dump the shutdown file // . // . // . } }
In reply to Re: Signal handling with (implicit) fork
by idsfa
in thread Signal handling with (implicit) fork
by polettix
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |