static __gshared struct

Basile B. via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jul 1 16:03:17 PDT 2016


On Friday, 1 July 2016 at 22:47:21 UTC, Hiemlick Hiemlicker wrote:
> what exactly does this do? are all members _gshared?

In this case __gshared is a complete NOOP. __gshared has only an 
effect on variables. It prevents them to reside in the TLS, so 
that they can be used by any thread of the program (even if then 
critical sections or atomic read/write are then necessary).

Static means that the declaration is like if in the global scope:

void main()
{
     static struct Foo{}
}

is like

struct Foo{}

void main(string[] args)
{}

It's not considered nested anymore.


More information about the Digitalmars-d-learn mailing list