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:
Attached is an untested patch. If it solved the Eric's Solaris
problem, I think it is a better solution.
I agree. I've regression tested this on x86-64 linux and it looks fine,
so I'm checking in this variant.
Thanks!
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 04:12:08 -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 04:12:08 -0000
@@ -281,6 +281,17 @@
// 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)
+ JvFail (strerror (c));
+}
+
void
_Jv_InitThreads (void)
{
@@ -296,6 +307,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 *
@@ -333,17 +348,6 @@
#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)
{