Unable to set static data member of a class (results in default value 0)

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 27 15:29:46 PDT 2017


On Sunday, 27 August 2017 at 22:21:11 UTC, Enjoys Math wrote:
>    static int dataReadDelay;

That's thread-local. Use shared to make it shared across all 
threads, and/or initialize it in the same thread as the use.


See:
https://dlang.org/migrate-to-shared.html
https://tour.dlang.org/tour/en/multithreading/thread-local-storage


More information about the Digitalmars-d-learn mailing list