[Gc] Using the Boehm-Demers-Weiser GC with a new threading library
Stephane.Epardaud at sophia.inria.fr
Wed May 4 05:12:49 PDT 2005
Ben Hutchings wrote:
> If you start from the linux_threads implementation I think you'll only
> need to change GC_push_all_stacks. Use GC_push_all to push the active
> part of each cooperative thread stack on the mark stack.
Thanks a lot, I'm looking into it right now, but I have two questions:
- Why does the linux_thread module need to push the GC_threads array on
the mark stack in GC_push_thread_structures() ? Is is because it is declared
as volatile ? I'm not sure what volatile means, but I thought the GC could
scan global variables (such as GC_threads), so I fail to see why I would need
to put anything in GC_push_thread_structures() ...
- If I use GC_push_all to push the active part of each cooperative thread
stack on the mark stack as you suggest, will that prevent the GC from looking
at the non-active part of that cooperative thread stack (since the stack in
question was allocated with GC_malloc, and I'm sure the GC will find a way to
that stack from either a root or a global variable) ? If not, is the correct
solution to allocated these roots via normal malloc and use GC_push_all, or
rather to keeping using GC_malloc and use GC_exclude_<something> to restrict
the scanning to the active part of the scan ?
More information about the Gc