I have been reading about SMPs machines(x86/ARM)and Compiler reordering for efficiency. Now I want to make a counter and the variable lives as a private member of ActivityLifecycleCallbacks implementation. The operations on this variable is performed on the callbacks from Android(which in always on UI thread).
Now because "x++" is not an atomic statement. Do I need to use AtomicInteger ? even If the variable is always only accessed on UI Thread?