GC interuptable?

Jarrett Billingsley kb3ctd2 at yahoo.com
Sat Dec 16 07:15:55 PST 2006


"Sean Kelly" <sean at f4.ca> wrote in message 
news:elvfpr$1l8j$1 at digitaldaemon.com...

> 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.

This also implies another way to have code run while the GC is running -- if 
you create a thread without using std.thread, the GC won't know about it and 
won't stop it during the collection.  So it can go ahead and run while the 
GC is doing its thing.

> 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 :-) 





More information about the Digitalmars-d mailing list