unsynchronized access to primitive variables
    David Nadlinger 
    see at klickverbot.at
       
    Sun May 20 08:31:08 PDT 2012
    
    
  
On Sunday, 20 May 2012 at 13:51:45 UTC, Dejan Lekic wrote:
> This proggy will always print "1" because writeln() prints the 
> value from the main thread. Spawned thread will have own value. 
> Remember TLS is the default storage.
This is wrong. _Global_ (or static) variables are in TLS by 
default, but local variables aren't automagically »thread 
local« in any sense – the fact that value is implicitly 
heap-allocated due to the closure does not change that.
David
    
    
More information about the Digitalmars-d-learn
mailing list