GC and realtime threads.

Chris Nicholson-Sauls ibisbasenji at gmail.com
Wed Jul 12 22:36:47 PDT 2006


chrisk wrote:
> I'm interested in trying D for writing some audio fx plugins. Basicly the 
> plugin would be a dll with 2 threads, a GUI and an Audio thread. Is it 
> posible to prevent the GC from running during the audio thread? Can the 
> audio thread stop the CG? As the dll will be loaded into a host application 
> does that mean the GC will halt the all dll and application threads while it 
> runs?
> 
> thanks,
> 
> chris 
> 

You can control the GC via the 'std.gc' import, which exposes the 'std.gc.disable()' and 
'std.gc.enable()' functions for turning automatic collection off/on, and the 
'std.gc.fullCollect()' function for manually initiating a collection run.

See: http://digitalmars.com/d/phobos/std_gc.html

As far as I know, in the case of cross-language DLL's (I assume the program you're writing 
the plugin for is not in D itself), the GC will only pause the DLL's own threads, but I 
could be wrong.

-- Chris Nicholson-Sauls



More information about the Digitalmars-d-learn mailing list