synchronized classes and shared
frame
frame86 at live.com
Thu Aug 18 11:18:18 UTC 2022
On Wednesday, 17 August 2022 at 21:49:11 UTC, Loara wrote:
> When dealing with `shared` variables according to the official
> documentation only atomic operations are allowed on them. But
> since `synchronized` classes can be accessed only by one thread
> at time it's reasonable to allow accessing its members even
> inside `shared` context, indeed the compiler allows it at least
> for small codes like the following:
It does not - which compiler version are you using?
Error: `shared` method `app.A.this` is not callable using a
non-shared object
And it shouldn't - shared (atomic lock free) and synchronized
(locking) are different concepts.
More information about the Digitalmars-d
mailing list