X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=libjava%2Fposix-threads.cc;h=0643c1a5c7b86053055652661f3c4bb808b99440;hb=bca30b067fb03fbaeccca1407ad94902cf8c660f;hp=03ae4535a05e21196d6588a531f76405a12afff1;hpb=7c2ddf15e59cec9fe51ad7eeac50ecb31762bc4c;p=pf3gnuchains%2Fgcc-fork.git 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 #include #include +#include // 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);