threads+CNI+SIGINT

Bryce McKinlay bryce@albatross.co.nz
Mon Mar 27 16:36:00 GMT 2000


Tom Tromey wrote:

> Jeff> In a native CNI method, what signal handlers (if any) can I
> Jeff> safely install?  Some signals are reserved by boehm-gc and
> Jeff> linuxthreads.  Is this documented?  (I know, I'm too
> Jeff> lazy/time-crunched to go look for myself.)
>
> This area isn't documented.
> You could probably handle any signal that isn't handled by the GC,
> LinuxThreads, or by the runtime (the runtime currently handles SIGSEGV,
> SIGFPE, and SIGPIPE).

Its best to NOT handle SIGINT and friends in a multithreaded application.
Linuxthreads knows how to clean up properly on these signals and adding
your own handler messes it up.

Implementing Runtime.addShutdownHook() should be the way to go for
terminal cleanups, etc. Do pthreads cleanup handlers get run on a SIGINT?

  [ bryce ]





More information about the Java mailing list