[Gc] Win32 threads, thread-local allocation, and gc7

Boehm, Hans hans.boehm at hp.com
Mon May 7 17:18:34 PDT 2007

I just checked in a fairly major patch (attached) into the gc7 tree,
which hopefully unbreaks the DllMain-based thread tracking code on

Under gc7, the default is always to insist on calls to the GC_ versions
of the thread creation primitives, which allows the GC to keep track of
threads as they are created, as on other platforms.  However, with the
GC as a dynamic library, it is still possible to instead track thread
creation implicitly using windows DllMain callbacks, which allows
Windows thread creation primitives to be called directly.  (To do this,
call GC_use_DllMain() before any other GC routines.)This appears easy to
do on Windows, but is in fact quite tricky to get right.  It matters
more there, since it's harder to get the linker's help in intercepting
library symbols.

With luck, this was the last significant regression from 6.8.  (I trust
the design of the 7.0 code more than that in 6.8, but it has a lot less
mileage on it.)

I'll now see if I can enable thread-local allocation by Windows, at
least in the static library case.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: win32_dll_diffs
Type: application/octet-stream
Size: 10515 bytes
Desc: win32_dll_diffs
Url : https://napali.hpl.hp.com/pipermail/gc/attachments/20070508/91160f93/win32_dll_diffs.obj

More information about the Gc mailing list