Variable modified by different threads.

Salih Dincer salihdb at hotmail.com
Mon Dec 2 15:18:01 UTC 2024


On Monday, 2 December 2024 at 08:00:40 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
> You don't need both atomics an mutex's, pick one.

The compiler wants us to use atomicOp; If you want, take it out 
of the synchronized(mutex) { } block, it doesn't matter:

> onlineapp.d(20): Error: read-modify-write operations are not 
> allowed for `shared` variables
onlineapp.d(20):        Use `core.atomic.atomicOp!"+="(this.gInt, 
value)` instead

SDB at 79


More information about the Digitalmars-d-learn mailing list