dmd 2.066(rc) generates warning: 'Deprecation: Read-modify-write operations
are not allowed for shared variables. Use core.atomic.atomicOp!-=(a, 1)
instead.' for following code:
synchronized {
++a;
}
Is that correct given that it's inside synchronized?
On Tue, 12 Aug 2014 03:01:22 -0700
Timothee Cour via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
Is that correct given that it's inside synchronized?
yes. synchronized doesn't lock *any* access to a (consider two
different shared classes, for example), it just prevents
On Tuesday, 12 August 2014 at 15:06:38 UTC, ketmar via
Digitalmars-d-learn wrote:
besides, using atomic operations will allow you to drop
synchronize altogether which makes your code slightly faster.
... and potentially quite broken. At the very least, if this
value is ready anywhere
On Tue, 12 Aug 2014 16:02:01 +
Sean Kelly via Digitalmars-d-learn digitalmars-d-learn@puremagic.com
wrote:
... and potentially quite broken. At the very least, if this
value is ready anywhere you'll have to use an atomicLoad there in
place of the synchronized block you would have used.