[concurrency-interest] How bad can volatile long++ be?

David Holmes dcholmes at optusnet.com.au
Mon Dec 10 18:07:59 EST 2007

David Gallardo writes:
> ++ is not atomic; while it may effectively be so on a single processor
> machine, this is not the case on multiprocessor machines.

It isn't the case on single processor machines either. ++ is
read-modify-write sequence and a thread can be preempted at any point in the

++ is just syntatic short-hand. Write it out in full and you'd never expect
it to be atomic.

David Holmes

More information about the Concurrency-interest mailing list