@cheatfate, Interesting, and good timing.

What about this bit of **test/threads/treusetvar.nim** for your new code: 
    
    
    +for i in 0..(ThreadsCount - 1):
    +  var thread: Thread[Marker]
    +  createThread(thread, worker, p)
    +  joinThread(thread)
    +echo p.counter
    

Shouldn't `var thread:` be outside the for-loop?

I tried it with my month-old Nim, and it does indeed hang either way. But why? 
Isn't `var` a brand new thing on the stack each time through the for-loop, 
fully zeroed?

My guess: The ThreadId was simply the address, and in this case the address 
does not change. And that's why it was so important to make `Thread` objects 
re-usable. Yes?

Reply via email to