December 03, 2011 Non-atomic ops allowed on shared variables? | ||||
|---|---|---|---|---|
| ||||
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?
| ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply