Quantcast
Channel: long and double assignments are not atomic - How does it matter? - Stack Overflow
Browsing latest articles
Browse All 4 View Live

Answer by Jeffrey for long and double assignments are not atomic - How does...

I made a cool little example of this a while agopublic class UnatomicLong implements Runnable { private static long test = 0; private final long val; public UnatomicLong(long val) { this.val = val; }...

View Article



Answer by Affe for long and double assignments are not atomic - How does it...

Where improper programming with an int may result in stale values being observed, improper programming with a long may result in values that never actually existed being observed.This could...

View Article

Answer by William Morrison for long and double assignments are not atomic -...

It makes a difference if SharedInt or SharedLong are going to be accessed simultaneously. As you said, one thread may read a stale int, or a stale or corrupted long.This could be important if the value...

View Article

long and double assignments are not atomic - How does it matter?

We know that long and double assignments are not atomic in Java until they are declared volatile. My question is how does it really matter in our programming practice. for instance if you the see below...

View Article
Browsing latest articles
Browse All 4 View Live




Latest Images