[Gc] Using the Boehm-Demers-Weiser GC with a new threading library
ben.hutchings at businesswebsoftware.com
Wed May 4 07:13:21 PDT 2005
Stephane Epardaud wrote:
> Ben Hutchings wrote:
> > <snip>
>> 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() ?
Maybe it's because the GC could be built as a shared library and static
data in shared libraries may not be scanned (this depends on
configuration and platform; note that this implementation is not just
used on Linux). Maybe it's not needed at all.
> - 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) ?
No; the stack should be allocated using GC_malloc_atomic so that it
won't automatically be scanned for pointers.
More information about the Gc