summaryrefslogtreecommitdiff
path: root/libjava/posix-threads.cc
diff options
context:
space:
mode:
authordaney <daney@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-12 16:20:11 +0000
committerdaney <daney@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-12 16:20:11 +0000
commit25ee750cb3b15dd78ed0f4b8ed60ae99c6757359 (patch)
treed4c32b005acd50085c465f85fda29e5885955ec5 /libjava/posix-threads.cc
parentcac7aa1938d91c9f3dd452419524c4f6e9571408 (diff)
downloadgcc-25ee750cb3b15dd78ed0f4b8ed60ae99c6757359.tar.gz
2004-08-12 David Daney <ddaney@avtrex.com>
PR libgcj/11801 * java/lang/PosixProcess.java: Rewrote. * java/lang/natPosixProcess.cc: Rewrote. * java/lang/Runtime.java (execInternal): Declare throws IOException. * gcj/javaprims.h (ConcreteProcess$ProcessManager): Declare. * posix-threads.cc (block_sigchld) New function. (_Jv_ThreadRegister) Use it. (_Jv_ThreadStart) Use it. * configure.in (PLATFORM_INNER_NAT_HDRS): New AC_SUBST() used in... * Makefile.am: ... to specify extra native headers. * configure: Regenerated. * include/config.h: Regenerated. * Makefile.in: Regenerated. * gcj/Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85880 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/posix-threads.cc')
-rw-r--r--libjava/posix-threads.cc20
1 files changed, 19 insertions, 1 deletions
diff --git a/libjava/posix-threads.cc b/libjava/posix-threads.cc
index 03ae4535a05..0643c1a5c7b 100644
--- a/libjava/posix-threads.cc
+++ b/libjava/posix-threads.cc
@@ -1,6 +1,6 @@
// posix-threads.cc - interface between libjava and POSIX threads.
-/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2004 Free Software Foundation
This file is part of libgcj.
@@ -34,6 +34,7 @@ details. */
#include <java/lang/System.h>
#include <java/lang/Long.h>
#include <java/lang/OutOfMemoryError.h>
+#include <java/lang/InternalError.h>
// This is used to implement thread startup.
struct starter
@@ -332,6 +333,17 @@ _Jv_ThreadSetPriority (_Jv_Thread_t *data, jint prio)
#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)
{
@@ -358,6 +370,8 @@ _Jv_ThreadRegister (_Jv_Thread_t *data)
_Jv_self_cache[current_index].high_sp_bits = BAD_HIGH_SP_VALUE;
}
# endif
+ // Block SIGCHLD which is used in natPosixProcess.cc.
+ block_sigchld();
}
void
@@ -403,6 +417,10 @@ _Jv_ThreadStart (java::lang::Thread *thread, _Jv_Thread_t *data,
return;
data->flags |= FLAG_START;
+ // Block SIGCHLD which is used in natPosixProcess.cc.
+ // The current mask is inherited by the child thread.
+ block_sigchld();
+
param.sched_priority = thread->getPriority();
pthread_attr_init (&attr);