[Gc] Re: External thread suspension (again)

Hans Boehm Hans.Boehm at hp.com
Sat Jun 3 21:48:54 PDT 2006

Sorry about the slow resposne.

In general, this also looks like a better approach to me.  Thanks.

Some comments/questions:

1) I don't see where the SUSPENDED flag gets set in response to
GC_suspend_thread.  It gets set in GC_suspend_self(), but I don't
think you get there unless it has already been set?

2) You should probably call GC_brief_async_signal_safe_sleep().
Last time I looked nanosleep wasn't technically async-signal-safe,
but I think select() always has been.

3) Have you thought about the various possible signal races, and which
signals are masked at what point?  I haven't yet had a chance to.  It
may be fine, but if there's an obvious argument that it is, a
comment would be great.

4) IIRC, GC_start_blocking() has a fundamental issue in that there isn't
really a good way to guarantee that all callee-saves registers are visible
onthe stack at the right point.  The result might be very occasional
failures.  So long as this is used only for debugging, and since this
is fixed with an interface change in 7.0, which can be easily accomodated
by your patch, I'd lean towards ignoring this for now.  The more
ambitious, and more correct, solution would be to backport the gc7
do_blocking() code.


On Fri, 26 May 2006, Keith Seitz wrote:

> Including GC list
> -------- Original Message --------
> Subject: Re: [RFC] GC: external thread suspension
> Date: Thu, 25 May 2006 12:39:58 -0700
> From: Keith Seitz <keiths at redhat.com>
> To: Java Patch List <java-patches at gcc.gnu.org>
> Okay, since it has been relatively quiet for the past week, I thought I
> would turn this into an official RFA.
> I'm going to be conservative, and offer up for approval the patch
> suggested by Hans Boehm, using GC_start/end_blocking. It is much simpler
> than my original patch.
> In order to modify gc.h, it looks like I need to ifdef stuff. Since I've
> only done this for pthreads, I've made a best guess as to the proper
> conditions. Let me know if there are any problems with this.
> Keith
> ChangeLog
> 2006-05-25  Keith Seitz  <keiths at redhat.com>
>            * pthread_stop_world.c (GC_suspend_handler): Redirect to
> suspension
>            routine if signal is received and thread is flagged SUSPENDED.
>            (GC_suspend_self): New function.
>            (GC_suspend_thread): New function.
>            (GC_resume_thread): New function.
>            * include/gc.h (GC_suspend_self): Declare.
>            (GC_suspend_thread): Declare.
>            (GC_resumet_thread): Declare.
>            * include/private/pthread_support.h (SUSPENDED): New GC_thread
>            flag.

More information about the Gc mailing list