This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: WIN-02: get boehm-gc autodetect if it is compiled as a DLL




> -----Original Message-----
> From: Adam Megacz [mailto:patches@lists.megacz.com]
> Interesting -- why does the GC need to know about thread creation? Is
> that so that it can scan each thread's stack?
> 
> I'm interested in supporting threads in statically linked gcj
> binaries; could we add a way for libgcj's java.lang.Thread to notify
> boehm-gc when threads are created? If you let me know what function to
> call (I assume it should be called from the new thread's context), I
> will insert the call in win32's natThread.cc.
> 
Right.  It needs to scan the stacks.  It also needs to temporarily stop the
threads.

The relevant code is not currently a separate function in the win32 case.
It's the DLL_THREAD_ATTACH/DETACH case in DllMain in win32_threads.c.

Looking at the code in win32_threads.c (I didn't write much of it), it might
actually be easier to just use the Windows CE code in the same file.  I
would guess that's not far away from working on win32.  It mostly defines a
GC-aware replacement for CreateThread().  This is much closer to what the
pthread support implementations do, and should work fine with static
libraries.

> 
> > Should the first test just be
> > 
> > #if defined(__MINGW32__) && defined(_DLL) && !defined(GC_NOT_DLL)
> 
> Yes, that should work.
> 
Did that in my tree.

Hans


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]