Do threads 'end' themselves using core.thread?

Sean Kelly sean at invisibleduck.org
Mon Jul 22 09:54:48 PDT 2013


On Jul 20, 2013, at 12:34 PM, Alex Horvat <alexh at gmail.com> wrote:

> If I use core.thread.Thread to create a new thread associated to a function like this:
> 
> Thread testThread = new Thread(&DoSomething);
> 
> Will the testThread dispose of itself after DoSomething() completes, or do I need to join/destroy/somethingelse testThread?

The thread will clean itself up automatically if you don't hold any references to it.  In essence, the thread's dtor will conditionally release any handles if join() was never called.



More information about the Digitalmars-d-learn mailing list