GC interuptable?

Sean Kelly sean at f4.ca
Sat Dec 16 09:05:06 PST 2006


chrisj wrote:
> "Jarrett Billingsley" <kb3ctd2 at yahoo.com> wrote in message 
> news:em12j3$6ls$1 at digitaldaemon.com...
>> "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.
> 
> How hard would it be to stop such a thread buggering up the GC? 

It shouldn't be the sole owner of GCed memory or the memory may 
disappear out from under it.  Beyond that, it should be fine.


Sean



More information about the Digitalmars-d mailing list