std.functional.memoize : thread local or __gshared memoization?
Kagamin via Digitalmars-d
digitalmars-d at puremagic.com
Sat May 27 09:16:38 PDT 2017
On Saturday, 27 May 2017 at 10:02:35 UTC, Jonathan M Davis wrote:
> Actually, not so much, because in D, most variables are _not_
> shared across threads (unlike in C).
If you don't share data, you don't need to worry how to share
data. But if you do, D supports C model.
> The compiler is free to assume that if a variable is not marked
> as shared, it's thread-local, and it can optimize accordingly.
Just like in C.
> Using __gshared on anything other than C globals is just
> begging for trouble.
Just like in C.
> As such, I'd strongly argue that using __gshared with anything
> other than actual C globals is a serious code smell, and it's a
> practice that should be actively discouraged.
You can't just discourage to write code. What to do instead, open
a bakery?
More information about the Digitalmars-d
mailing list