This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java 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: ProcessManager on Solaris


David Daney wrote:
Bryce McKinlay wrote:


libjava uses the regular POSIX threads on Solaris. As Hans mentioned, we should migrate the boehm-gc to use the standard pthreads code on Solaris too.


The reason why the mask isn't applied to the GC's daemon thread is that we initialize the GC before we attach the main thread, so the signal mask isn't applied to the main thread yet. An alternate solution would be to make sure block_sigchld() gets called from the main thread before _Jv_InitGC().


Then this is a latent bug in the boehm-gc/pthread also.


int libjava/posix-threads.cc _Jv_InitThreads() we must call block_sigchld(). This would fix both the latent pthread bug as well as Eric's Solaris problem.


Attached is an untested patch. If it solved the Eric's Solaris problem, I think it is a better solution.


If this works I can test and commit if desired.

David Daney.
Index: libjava/posix-threads.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/posix-threads.cc,v
retrieving revision 1.35
diff -c -p -r1.35 posix-threads.cc
*** libjava/posix-threads.cc	12 Aug 2004 16:20:08 -0000	1.35
--- libjava/posix-threads.cc	16 Feb 2005 02:05:52 -0000
*************** handle_intr (int)
*** 281,286 ****
--- 281,297 ----
    // Do nothing.
  }
  
+ static void
+ block_sigchld()
+ {
+   sigset_t mask;
+   sigemptyset (&mask);
+   sigaddset (&mask, SIGCHLD);
+   int c = pthread_sigmask (SIG_BLOCK, &mask, NULL);
+   if (c != 0)
+     throw new java::lang::InternalError (JvNewStringUTF (strerror (c)));
+ }
+ 
  void
  _Jv_InitThreads (void)
  {
*************** _Jv_InitThreads (void)
*** 296,301 ****
--- 307,315 ----
    sigemptyset (&act.sa_mask);
    act.sa_flags = 0;
    sigaction (INTR, &act, NULL);
+ 
+   // Block SIGCHLD which is used in natPosixProcess.cc.
+   block_sigchld();
  }
  
  _Jv_Thread_t *
*************** _Jv_ThreadSetPriority (_Jv_Thread_t *dat
*** 333,349 ****
  #endif
  }
  
- static void
- block_sigchld()
- {
-   sigset_t mask;
-   sigemptyset (&mask);
-   sigaddset (&mask, SIGCHLD);
-   int c = pthread_sigmask (SIG_BLOCK, &mask, NULL);
-   if (c != 0)
-     throw new java::lang::InternalError (JvNewStringUTF (strerror (c)));
- }
- 
  void
  _Jv_ThreadRegister (_Jv_Thread_t *data)
  {
--- 347,352 ----

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