debugging threads vs processes

Boehm, Hans
Fri Jul 13 09:26:00 GMT 2001

> From: Tom Tromey [ ]
> It might be worse than that.  boehm-gc overrides various pthread_*
> functions so that it can keep track of what is going on.  Apache might
> need to be recompiled so that it calls these functions.  At least, if
> Apache uses threads and if it can create new threads that use libgcj
> without notifying the GC.  This is all platform dependent.  Offhand I
> don't know which platforms use overrides and which use other methods.
On Unix-like platforms it uses overrides implemented with macros in gc.h.
With GNU ld, the collector should also be able to implement the overrides
with --wrap instead of using macro definitions.  This might make it
unnecessary to recompile other code in situations like this, but I don't
think the libgcj build process currently supports it.  Nor has it received a
lot of testing. 

Any threads created without the wrapper for pthread_create will not be
stopped, not will the corresponding stack be scanned by the gc.  There may
be other issues if they are, for example, joined by a thread the gc knows

With win32 threads, DllMain is used to watch for new threads.  That
mechanism seems to work unless there are threads already running when the
collector dll is loaded.


More information about the Java mailing list