shared attribute

Jonathan M Davis jmdavisProg at gmx.com
Sun May 13 02:35:25 PDT 2012


On Sunday, May 13, 2012 11:24:58 japplegame wrote:
> Does shared attribute automatic synchronization or should I do it
> manually?

shared does not automatically synchronize anything. It just means that the 
variable is shared across threads rather than being thread-local, and the 
compiler takes that into account with whatever optimizations and code 
generation it does. It does nothing to protect against multiple threads 
accessing it simultaneously.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list