Non-atomic ops allowed on shared variables?

Andrej Mitrovic andrej.mitrovich at gmail.com
Sat Dec 3 09:32:15 PST 2011


I thought this wasn't allowed:

shared uint threadsCount;

void bumpThreadsCount()
{
    ++threadsCount;
}

void main()
{
}

According to TDPL it should error and we should use atomicOp from
std.concurrency instead. atomicOp is what I've used so far if I had to
use shared variables. Has ++ suddenly become atomic automatically or
is this a bug?


More information about the Digitalmars-d-learn mailing list