[Gc] explicit thread registration

MenTaLguY mental at rydia.net
Sat Dec 8 11:40:49 PST 2007

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 valgrind/cachegrind.

So, the remaining needs for Inkscape are:

 - a macro which can be defined by the application to disable thread
 - 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
 - the ability to explicitly deregister the current thread (implicit
deregistration would still be necessary in some cases)

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?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://napali.hpl.hp.com/pipermail/gc/attachments/20071208/38b9e4dd/attachment.pgp

More information about the Gc mailing list