[Gc] Unregistering the main thread

Boehm, Hans hans.boehm at hp.com
Mon Sep 15 13:09:33 PDT 2008


A blocking system call doesn't normally stop allocation or garbage collection anyway.  GC_unregister_my_thread isn't actually intended for this kind of use.  Using it is potentially dangerous, since frames nearer the cool end of the stack will also no longer be scanned.

I would be inclined to turn this into eiher a no-op or (on pthreads with recent GC) GC_do_nonblocking().  The latter avoids having the GC send signals that interrupt (and hopefully restart) the system call.

Hans

> -----Original Message-----
> From: gc-bounces at napali.hpl.hp.com
> [mailto:gc-bounces at napali.hpl.hp.com] On Behalf Of Ludovic Courtès
> Sent: Monday, September 15, 2008 12:10 PM
> To: gc at napali.hpl.hp.com
> Subject: [Gc] Unregistering the main thread
>
> Hello,
>
> Guile has an API that allows a program to specify that a
> given thread is not going to cooperate for GC for some time.
> This is useful, e.g., when a thread enters a blocking system
> call and doesn't want to prevent other threads from
> allocating memory or collecting garbage while it's blocked:
>
>   scm_without_guile (the_function_that_blocks, NULL);
>
> On the port of Guile to BDW-GC, I implement it using
> `GC_unregister_my_thread ()' and `GC_register_my_thread ()'.
> However, it appears that the main thread cannot be unregistered.
>
> What is the main thread supposed to do when it enters, say, a
> blocking system call and may not be able to cooperate for GC
> for a while?
>
> Thanks,
> Ludovic.
>
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
>



More information about the Gc mailing list