summaryrefslogtreecommitdiff
path: root/libjava/posix-threads.cc
diff options
context:
space:
mode:
authorDavid Daney <ddaney@avtrex.com>2007-05-12 17:37:55 +0000
committerDavid Daney <daney@gcc.gnu.org>2007-05-12 17:37:55 +0000
commit8c0dbf3490bd297d601118bc95a2a8640aa73a39 (patch)
treec786d0bbe368ad9664be7de23b5d9d5b106c0f34 /libjava/posix-threads.cc
parentc4160806e1a116b18498c97b969cc45e453104ce (diff)
downloadgcc-8c0dbf3490bd297d601118bc95a2a8640aa73a39.tar.gz
re PR libgcj/29324 (add wait handling hook)
PR libgcj/29324 * include/posix-threads.h (_Jv_BlockSigchld): Declare. (_Jv_UnBlockSigchld): Same. * posix-threads.cc: Include posix-threads.h. (block_sigchld) Rename to... (_Jv_BlockSigchld) ... this. (_Jv_UnBlockSigchld): New function. (_Jv_InitThreads): Call _Jv_BlockSigchld in place of block_sigchld. (_Jv_ThreadStart): Same. * java/lang/PosixProcess$ProcessManager.h: Regenerate. * java/lang/PosixProcess.java: Clean up imports. (ProcessManager): Make final. (ProcessManager.queue): Genericise and make private. (ProcessManager.pidToProcess): Remove. (ProcessManager.liveProcesses): New field. (ProcessManager.reaperPID): Remove. (ProcessManager.nativeData): New field. (ProcessManager.removeProcessFromMap): Remove. (ProcessManager.addProcessToMap):Remove. (ProcessManager.addToLiveProcesses): New method. (ProcessManager.run): Rewritten. (ProcessManager.reap): Change method signature, (getErrorStream): Correct formatting. (getInputStream): Same. (spawn): Add process to liveProcesses list. (pid): Make package private. * java/lang/PosixProcess.h: Regenerate. * java/lang/natPosixProcess.cc: Include posix.h and posix-threads.h. Add useing namespace java::lang. (ProcessManagerInternal): New struct. (sigchld_handler): Rewritten. (init): Rewritten. (waitForSignal): Same. (reap): Same. (signalReaper): Same. (nativeDestroy): Call kill as ::kill. (nativeSpawn): Correct formatting. * classpath/lib/java/lang/PosixProcess$EOFInputStream.class: Regenerate. * classpath/lib/java/lang/PosixProcess.class: Same. * classpath/lib/java/lang/PosixProcess$ProcessManager.class: Same. From-SVN: r124638
Diffstat (limited to 'libjava/posix-threads.cc')
-rw-r--r--libjava/posix-threads.cc22
1 files changed, 17 insertions, 5 deletions
diff --git a/libjava/posix-threads.cc b/libjava/posix-threads.cc
index 6ea724b3be8..287d6b79a6f 100644
--- a/libjava/posix-threads.cc
+++ b/libjava/posix-threads.cc
@@ -14,6 +14,7 @@ details. */
#include <config.h>
#include "posix.h"
+#include "posix-threads.h"
// If we're using the Boehm GC, then we need to override some of the
// thread primitives. This is fairly gross.
@@ -472,8 +473,8 @@ handle_intr (int)
// Do nothing.
}
-static void
-block_sigchld()
+void
+_Jv_BlockSigchld()
{
sigset_t mask;
sigemptyset (&mask);
@@ -484,6 +485,17 @@ block_sigchld()
}
void
+_Jv_UnBlockSigchld()
+{
+ sigset_t mask;
+ sigemptyset (&mask);
+ sigaddset (&mask, SIGCHLD);
+ int c = pthread_sigmask (SIG_UNBLOCK, &mask, NULL);
+ if (c != 0)
+ JvFail (strerror (c));
+}
+
+void
_Jv_InitThreads (void)
{
pthread_key_create (&_Jv_ThreadKey, NULL);
@@ -501,7 +513,7 @@ _Jv_InitThreads (void)
// Block SIGCHLD here to ensure that any non-Java threads inherit the new
// signal mask.
- block_sigchld();
+ _Jv_BlockSigchld();
// Check/set the thread stack size.
size_t min_ss = 32 * 1024;
@@ -581,7 +593,7 @@ _Jv_ThreadRegister (_Jv_Thread_t *data)
}
# endif
// Block SIGCHLD which is used in natPosixProcess.cc.
- block_sigchld();
+ _Jv_BlockSigchld();
}
void
@@ -629,7 +641,7 @@ _Jv_ThreadStart (java::lang::Thread *thread, _Jv_Thread_t *data,
// Block SIGCHLD which is used in natPosixProcess.cc.
// The current mask is inherited by the child thread.
- block_sigchld();
+ _Jv_BlockSigchld();
param.sched_priority = thread->getPriority();