libgcj signal handling problem

Andrew Morton akpm@osdl.org
Tue Aug 19 09:59:00 GMT 2003


Andrew Haley <aph@redhat.com> wrote:
>
> Andrew, I have appended a patch.  I'd be grateful if you would try
>  this patch on the system where you observed the problem.

ah, sorry, I was not the person who reported the problem.  It was
Cesar Barros (Cc'ed here).

Perhaps he can test the change..

Index: prims.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/prims.cc,v
retrieving revision 1.81
diff -p -2 -c -r1.81 prims.cc
*** prims.cc	21 Jul 2003 01:54:05 -0000	1.81
--- prims.cc	19 Aug 2003 09:21:02 -0000
*************** void (*_Jv_JVMPI_Notify_THREAD_END) (JVM
*** 123,126 ****
--- 123,140 ----
  

  
+ /* Unblock a signal.  Unless we do this, the signal may only be sent
+    once.  */
+ static void 
+ unblock_signal (int signum)
+ {
+ #ifdef _POSIX_SOURCE
+   sigset_t sigs;
+ 
+   sigemptyset (&sigs);
+   sigaddset (&sigs, signum);
+   sigprocmask (SIG_UNBLOCK, &sigs, NULL);
+ #endif
+ }
+ 
  #ifdef HANDLE_SEGV
  SIGNAL_HANDLER (catch_segv)
*************** SIGNAL_HANDLER (catch_segv)
*** 128,131 ****
--- 142,146 ----
    java::lang::NullPointerException *nullp 
      = new java::lang::NullPointerException;
+   unblock_signal (SIGSEGV);
    MAKE_THROW_FRAME (nullp);
    throw nullp;
*************** SIGNAL_HANDLER (catch_fpe)
*** 138,141 ****
--- 153,157 ----
    java::lang::ArithmeticException *arithexception 
      = new java::lang::ArithmeticException (JvNewStringLatin1 ("/ by zero"));
+   unblock_signal (SIGFPE);
  #ifdef HANDLE_DIVIDE_OVERFLOW
    HANDLE_DIVIDE_OVERFLOW;



More information about the Java mailing list