[Gc] explicit thread registration
hans.boehm at hp.com
Fri Dec 14 17:11:46 PST 2007
> From: MenTaLguY [mailto:mental at rydia.net]
> On Tue, 2007-12-04 at 01:01 +0000, Boehm, Hans wrote:
> > Have you looked at GC_register_my_thread and friends in gc7? You
> > still have to bypass the macro definitions of thread creation
> > primitives, which should probably be made easier. But otherwise it
> > sounds to me like that's bascically what you want
> Yes. That gets us about halfway there.
> > (except for the fact that it's not terribly well tested,
> and the code
> > for retrieving the thread stack base just returns
> GC_UNIMPLEMENTED on
> > some platforms).
> > GC_INIT() should register the thread it's called from,which
> may have
> > to be the main thread.
> Unfortunately the code for explicitly retrieving the base
> address of the current stack is the other half of the
> problem: e.g. on Linux it is incompatible with tools like
> So, the remaining needs for Inkscape are:
> - a macro which can be defined by the application to disable
> thread redirects
> - the ability to register the current thread (including the GC_INIT
> thread) with an explicit base stack address, which can be
> taken from the address of a local variable in a stack frame
> which the application knows will be "permanent" for the
> useful lifetime of the thread
There is GC_call_with_stack_base, which then allows you to call GC_register_my_thread() from within the called function.
> - the ability to explicitly deregister the current thread
> (implicit deregistration would still be necessary in some cases)
There is GC_unregister_my_thread().
> One approach would be to have a public
> GC_explicit_thread_registration variable which could be set
> prior to calling GC_INIT. Setting it would request explicit
> registration, in which case GC_INIT would register the
> current thread for the duration of the init call and then
> deregister it when the call completes; the application would
> then be responsible for registering the thread again like
> other threads.
> Does that seem reasonable?
More information about the Gc