[Gc] System V contexts and stack marking

Bruce Hoult bruce at hoult.org
Fri Aug 10 17:23:27 PDT 2007

On 8/11/07, Boehm, Hans <hans.boehm at hp.com> wrote:
> This wasn't really intended to be possible without supporting a new threads
> implementation in the collector itself.
> It may be possible to generate a small collector patch to support
> semi-threaded, say GC_CUSTOM_COOPERATIVE_THREADS configurations in which the
> collector just assumes that if it's running, nobody else is, no thread is
> ever preempted while holding the allocation lock, there is no point in
> thread-local allocation, or parallel GC, and the client is responsible for
> replacing GC_push_other_roots with a pointer to aan appropriate thread stack
> marking routine.
> The THREADS macro would still need to get set in such an environment, so
> theat GC_clear_stack doesn't get confused.  LOCK and UNLOCK could probably
> be empty.

We use GC in our cooperatively-threaded environment.  We simply use
GC_push_other_roots on thread stacks other than the current one, and
set GC_stackbottom on each thread switch to keep other things happy.
We don't define THREADS.

More information about the Gc mailing list