A few comments about D

Rainer Schuetze r.sagitario at gmx.de
Tue Aug 23 23:32:39 PDT 2011



On 24.08.2011 01:19, Timon Gehr wrote:
> On 08/24/2011 12:24 AM, Rainer Schuetze wrote:
>>
>> A way to deal with this could be done in the runtime library, allowing
>> to set a flag for the real time thread, that excludes it from being
>> suspended in a garbage collection. It is then the responsiblity of the
>> developer to ensure that any GC data used in the realtime thread is also
>> referenced elsewhere.
>
> Basically, afaik you can already get that now. It suffices not to
> register the new thread with the GC. (I don't know if core does provide
> an interface for this) The thread then has to use manual memory management.
>

I know there is the suggestion to use the C thread creation functions 
instead if you don't want to interact with the GC, but I don't think it 
works well:
- you need more thread initialization than just GC, e.g. TLS.
- you might want to setup the thread with GC, then disable it for any 
further processing
- a VST plugin is a DLL, and you are usually not the creator of the 
threads. The DLL initialization code attaches to all threads and adds 
them to the thread pool. You'll probably need control over which threads 
to suspend in a collection, and which threads are not allowed to use the GC.


More information about the Digitalmars-d mailing list