GC interuptable?

Sean Kelly sean at f4.ca
Fri Dec 15 16:48:56 PST 2006


chrisj wrote:
> Can a low level thread interupt the GC and run ok as long as it doesnt use 
> any GC related features? (Only referances memory not from the GC pool and 
> such like)

Are you asking whether it's safe to suspend the GC during a cleanup and 
then go do something else?  If so, then my answer is a very tenative 
"yes."  The GC suspends all threads it knows about during a collection 
(ie. all instances of std.thread.Thread) so each of these threads is 
frozen at some point of execution.  They could own mutexes, etc.  So any 
operation that may involve shared state information risks deadlocking 
the app.  In short, yes it's possible but you need to be very careful :-)


Sean



More information about the Digitalmars-d mailing list