Variable modified by different threads.
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Tue Dec 3 23:16:00 UTC 2024
On 04/12/2024 11:20 AM, Ali Çehreli wrote:
> On 12/3/24 9:47 AM, Richard (Rikki) Andrew Cattermole wrote:
> > On 04/12/2024 6:37 AM, Nick Treleaven wrote:
>
> >> |shared| - shared (i.e. accessible) across threads.
> >
> > That is already true.
>
> That conflicts with my knowledge of data being thread-local by default
> in D.
>
> > You don't need a type qualifier to tell you that.
> >
> > What you need the compiler assistance for, is to tell you that it is NOT
> > accessible to multiple threads.
>
> I think you are objecting to D's thread-local by default decision but
> I'm not sure. :)
>
> Ali
You are thinking of globals, which are by default TLS yes.
No objection to that here.
What owned by a thread means is that a pointer is guaranteed to only be
accessible by that thread. I.e. the cpu will segfault if you try to
access it from another thread.
Current CPU's don't offer this protection, so it would have to be proven
by the compiler using language features instead.
More information about the Digitalmars-d-learn
mailing list