How does D lang handle multithreaded applications and static members of classes?

bauss jacobbauss at gmail.com
Fri Apr 4 16:25:55 UTC 2025


On Thursday, 3 April 2025 at 18:45:50 UTC, Inkrementator wrote:
> On Wednesday, 2 April 2025 at 08:38:32 UTC, Daniel Donnelly, 
> Jr. wrote:
>> On Wednesday, 2 April 2025 at 08:33:05 UTC, Inkrementator 
>> wrote:
>>> All global variables in D, including static class members, 
>>> are thread local by default. You have to explicitly add the 
>>> `__gshared` attribute to the static variable to make it truly 
>>> global.
>
> Addendum: When you need non-thread-local global variable, look 
> into `shared` instead of `__gshared` to see if it meets your 
> needs.

shared is broken however.


More information about the Digitalmars-d-learn mailing list