Sergei Nosov:
Is this how shared is supposed to work? If so, how is the __gshared different from it? Does it not guarantee that the result of a write is instantly visible to all threads? If so, does this difference really matter?
shared and __gshared are very different things. __gshared guarantees nothing, it's equivalent to a raw C global (module-level) variables.
Bye, bearophile