Garbage Collector and Foreign Threads

will75g will75g at yahoo.it
Tue Mar 20 02:31:43 PDT 2007


Chris Warwick wrote:

> asumming win32 here as thats all i know but..
> 
> Couldnt the plugin create a local GUI thread? So when the host requests a 
> plugin instance, the dll actually creates a local thread that has it's own 
> windows message loop and that basicly runs the plugin and gui. So as long as 
> the host gui and audio thread dont cause any allocations or interfer in a 
> way that would break the gc, it should work? Of course some way for the 
> threads to interact / comunicate would need to be worked out but at least by 
> creating your own thread you can controll where the allocations occur. With 
> modern multicore it could be posible that more than one host gui thread 
> exists? And that would be very problematic i think.

Probably that would work on win32, but I have to support both Mac and 
PC, and if I remember correctly in OSX it's forbidden to call any GUI 
related coded from a thread that is not the main application thread (a 
simple operations such as invalidating a window area would cause a 
crash). Things are even more complicated if you add the fact that my 
plug-in GUI must live in a child window of the host window.



More information about the Digitalmars-d-learn mailing list