What exactly shared means?
John Colvin via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jan 3 05:53:08 PST 2015
On Saturday, 3 January 2015 at 13:33:21 UTC, Ola Fosheim Grøstad
wrote:
> On Saturday, 3 January 2015 at 12:17:52 UTC, ketmar via
> Digitalmars-d-learn wrote:
>> why should it? thread locals are... well, local for each
>> thread. you
>> can't access local of different thread without resorting to
>> low-level
>> assembly and OS dependent tricks.
>
> Of course you can, anything that is reachable through any chain
> of pointers/references is effectively "shared", not only the
> object you explicitly "share".
>
> So when you cast away "shared" then call a function and that is
> safe in itself, you don't know what happens when someone
> modifies some function deep down in the call chain later on and
> access some private pointer chain and possibly retain a pointer
> to it.
>
> The alternative is to put "shared" on all parameters in
> libraries or avoid using libraries...
I think you're talking cross-purposes. thread-local as in TLS
v.s. thread-local as in not-shared.
More information about the Digitalmars-d-learn
mailing list