[concurrency-interest] How bad can volatile long++ be?
Joe Bowbeer
joe.bowbeer at gmail.com
Mon Dec 10 13:30:09 EST 2007
++ of any numeric field is not atomic with or without volatile.
however, all numeric fields except longs are read and written
atomically. volatile adds this feature to longs; otherwise the two int
halves might be processed separately.
On 12/10/07, Sam Berlin <sberlin at gmail.com> wrote:
> Hi Folks,
>
> I'm fairly certain that ++ is not an atomic operation, even on
> volatile variables, on longs (and quite possibly ints). Given that is
> true (which it very well might not be), is it suspectible to problems
> where a wildly wrong number can be produced (due to different bytes
> being updated at different times from different threads), or will it
> just cause some increments to effectively not happen?
>
> Thanks!
> Sam
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at altair.cs.oswego.edu
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>
More information about the Concurrency-interest
mailing list