Garbage Collector and Foreign Threads

Sean Kelly sean at f4.ca
Tue Mar 20 08:28:51 PDT 2007


will75g wrote:
> 
> If I understand correctly being able to block the foreign thread is not 
> enough, because the GC must also be able to inspect the thread stack.

Yes.  And the thread which initiates the collection doesn't need to be 
blocked (since it's running the collection) but its stack still must be 
inspected, assuming it holds references to GCed data.

 > If
> that's the case, your proxy thread idea is probably the cleanest 
> solution. I'll see if I can manage to implement it (having something 
> like that in Tango would be fantastic).

To do this, I suggest looking at how the proxy for the main thread is 
set up in std.thread.Thread.thread_init().  Tango does something similar 
in thread_init() within tango.core.Thread.

Let me think about this a bit more to make sure I can't think of any 
weird problems with the approach and if not then I'll add the feature to 
Tango.


Sean


More information about the Digitalmars-d-learn mailing list