how to assign to shared obj.systime?
Arafel
er.krali at gmail.com
Tue Jul 14 06:17:09 UTC 2020
On 14/7/20 8:05, Kagamin wrote:
> On Monday, 13 July 2020 at 07:26:06 UTC, Arafel wrote:
>> That's exactly why what I propose is a way to *explicitly* tell the
>> compiler about it, like @system does for safety.
>
> With __gshared you can opt out from sharing safety, then you're back to
> old good C-style multithreading.
That's apples and oranges.
I do agree in principle with the idea of `shared`, I just want a way to
tell the compiler that `shared` doesn't apply *within a given block*, if
possible also only for some specific variables, because I have already
taken care of the synchronization, that's exactly what the system tries
to promote.
__gshared on the other hand is just dispensing with the `shared` system
altogether and giving up the protections it offers. Furthermore it only
works for global objects and static variables/members [1], so its use is
limited.
[1]: https://dlang.org/spec/attribute.html#gshared
More information about the Digitalmars-d-learn
mailing list