ProcessManager on Solaris
David Daney
ddaney@avtrex.com
Wed Feb 16 06:49:00 GMT 2005
Eric Botcazou wrote:
>>It should be pretty trival to fix boehm-gc to block SIGCHLD. Basically
>>you should just need to copy the pthread_sigmask() code from
>>block_sigchld in posix-threads.cc into GC_pthread_create in
>>solaris_pthreads.c. I think it would be fine to make that change in
>>order to fix this problem, so please submit a patch.
>>> Indeed, if I'm allowed to directly patch Boehm GC, the fix is trivial.
> Attached, tested on SPARC64/Solaris 9.
>>> 2005年02月16日 Eric Botcazou <ebotcazou@libertysurf.fr>
>> * solaris_threads.c (GC_thr_daemon): Block SIGCHLD.
>>>>> ------------------------------------------------------------------------
>> Index: solaris_threads.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/boehm-gc/solaris_threads.c,v
> retrieving revision 1.12
> diff -u -p -r1.12 solaris_threads.c
> --- solaris_threads.c 16 Aug 2004 16:32:26 -0000 1.12
> +++ solaris_threads.c 15 Feb 2005 23:09:05 -0000
> @@ -743,7 +743,13 @@ void * GC_thr_daemon(void * dummy)
> register GC_thread t;
> register int i;
> register int result;
> -
> + sigset_t mask;
> +
> + /* Libgcj's ProcessManager requires that SIGCHLD be delivered to it. */
> + sigemptyset (&mask);
> + sigaddset (&mask, SIGCHLD);
> + thr_sigsetmask (SIG_BLOCK, &mask, NULL);
> +
> for(;;) {
> start:
> result = thr_join((thread_t)0, &departed, &status);
What happens if the SIGCHLD is received between the beginning of this
function and the thr_sigsetmask?
I am not a Solaris threads expert, but it looks like a race condition.
New threads are documented to inherit their signal mask from the parent.
Where is the Solaris equivalent of libjava/posix-threads.cc ? The
signal mask is set in there for posix-threads (look for calls to
block_sigchld() in _Jv_ThreadRegister and _Jv_ThreadStart.
David Daney.
More information about the Java
mailing list