Thread will get garbage collected?

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jan 17 01:38:19 PST 2017


On Tuesday, 17 January 2017 at 08:58:33 UTC, Arun Chandrasekaran 
wrote:
> Interesting. Why doesn't the thread get GC'd in this case even 
> without any reference still active?

basically 'cause there is no reliable way to correctly "abort" a 
thread. nobody knows what is really going on inside it, so 
shooting it down is very unsafe. i.e. aborting thread in the 
middle of something is very-very wrong, so it is programmer's 
responsibility to stop (or detach) all the created threads.

note that fibers *will* be collected.


More information about the Digitalmars-d-learn mailing list