[Gc] Win32: DLLs and thread registration

Boehm, Hans hans.boehm at hp.com
Tue Feb 12 11:00:15 PST 2008

> -----Original Message-----
> From: gc-bounces at napali.hpl.hp.com
> [mailto:gc-bounces at napali.hpl.hp.com] On Behalf Of Christian Gudrian
> Sent: Tuesday, February 12, 2008 4:16 AM
> To: GC Mailing List
> Subject: Re: [Gc] Win32: DLLs and thread registration
> Christian Gudrian wrote:
> > I did exactly that: I added a call to GC_init_parallel() at
> the very
> > end of GC_use_DllMain().
> In this setup you must not call GC_INIT() but instead only
> GC_use_DllMain().  The reason is that GC_INIT() registers the
> main thread (which is good) but uses the wrong method since
> GC_win32_dll_threads still is 0 (which is bad).  Since
> GC_use_DllMain() now calls GC_init_parallel() (now with
> GC_win32_dll_threads set to 1) which in turn finally calls
> GC_INIT() there is no need to call GC_INIT() explicitly anyway.
The comment in gc.h should have said to call GC_use_DllMain() before GC_INIT().  It will say that, now.  (I think it actually doesn't matter whether you call it before or instead of "GC_INIT()".  "Before" looks aesthetically slightly cleaner to me, but ...)

Thanks again.

> Christian
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> https://www.hpl.hp.com/hosted/linux/mail-archives/gc/

More information about the Gc mailing list