On Wednesday, 22 February 2017 at 07:14:27 UTC, Jonathan M Davis wrote:
In this particular case, the program would probably exit if you did

void main()
{
    {
        auto a = new A;
    }

    import core.memory;
    GC.collect();
}

I very much doubt so. A Thread object isn't just a handle or thread reference, but also encapsulates some of the system/druntime state required to make threading work. Executing Thread.~this() while a thread was still running would lead to a crash.

(The tricky part is to make sure the Thread object becomes eligible for collection once a thread has actually finished.)

 — David

Reply via email to