How are theads, Tid and spawn related?

Sean Kelly via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Nov 2 09:04:27 PST 2014


On Sunday, 2 November 2014 at 06:23:38 UTC, Ali Çehreli wrote:
> On 11/01/2014 11:13 PM, Sean Kelly wrote:
>
> > Note that thread_joinAll is called automatically when main
> exits
>
> Has that always been the case? I remember having to inject 
> thread_joinAll() calls at the ends of the main()s of a couple 
> of examples because of having trouble otherwise.
>
> Can I safely remove thread_joinAll()s if they are the last 
> lines in main()?

It has always been the case.  In fact, I have a comment in the 
body of Thread.start() explaining this potential race and 
explaining the need for certain operations in that function.  So 
if there is a race, it isn't meant to be here and should be 
fixed.  I also just filed: 
https://issues.dlang.org/show_bug.cgi?id=13672 so some attention 
needs to be paid to this function anyway.



More information about the Digitalmars-d-learn mailing list