std.functional.memoize : thread local or __gshared memoization?
Ola Fosheim Grøstad via Digitalmars-d
digitalmars-d at puremagic.com
Sat May 27 07:20:38 PDT 2017
On Saturday, 27 May 2017 at 11:52:04 UTC, John Colvin wrote:
> Nope. __gshared isn't even part of the type so it can't do that.
>
> __gshared int a;
>
> void main()
> {
> foo(a);
But this should fail since foo doesn't take shared?
> __gshared is a way of declaring a C-like global variable, but D
> does not - in general - support accessing it in a C-like way.
> My advice is to cast to shared before use, unless you're
> totally sure you know what other threads will be doing.
Why isn't it always typed as shared?
More information about the Digitalmars-d
mailing list