This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
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.
Hmm, I don't think so, unless something like --enable-parallel-mark is
used, because the GC doesn't normally create any additional threads.
We'll still set the right mask before any Java code gets run. But anyway...
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.
Yes, good solution! I'll commit this patch instead of Eric's assuming it
tests out ok. Eric, can you confirm that this one fixes the original
problem on Solaris?
Bryce
2005-02-15 David Daney <ddaney@avtrex.com>
Bryce McKinlay <mckinlay@redhat.com>
* prims.cc (_Jv_CreateJavaVM): Add comment about initialization order.
* posix-threads.cc (_Jv_InitThreads): Call block_sigchld() here to
ensure that GC threads inherit the new signal mask.
(block_sigchld): Call JvFail rather than throwing exception if
pthread_sigmask() fails.
Index: prims.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/prims.cc,v
retrieving revision 1.102
diff -u -r1.102 prims.cc
--- prims.cc 2 Feb 2005 16:19:42 -0000 1.102
+++ prims.cc 16 Feb 2005 02:38:51 -0000
@@ -921,6 +921,8 @@
PROCESS_GCJ_PROPERTIES;
+ /* Threads must be initialized before the GC, so that it inherits the
+ signal mask. */
_Jv_InitThreads ();
_Jv_InitGC ();
_Jv_InitializeSyncMutex ();
Index: posix-threads.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/posix-threads.cc,v
retrieving revision 1.35
diff -u -r1.35 posix-threads.cc
--- posix-threads.cc 12 Aug 2004 16:20:08 -0000 1.35
+++ posix-threads.cc 16 Feb 2005 02:38:51 -0000
@@ -296,6 +296,10 @@
sigemptyset (&act.sa_mask);
act.sa_flags = 0;
sigaction (INTR, &act, NULL);
+
+ // Block SIGCHLD here to ensure that any non-Java threads inherit the new
+ // signal mask.
+ block_sigchld();
}
_Jv_Thread_t *
@@ -341,7 +345,7 @@
sigaddset (&mask, SIGCHLD);
int c = pthread_sigmask (SIG_BLOCK, &mask, NULL);
if (c != 0)
- throw new java::lang::InternalError (JvNewStringUTF (strerror (c)));
+ JvFail (strerror (c));
}
void