Need synchronization for an increment-only counter?
If you just used an int or long variable then you would need synchronization – incrementing involves read / increment-locally / write, which is far from an atomic operation. (Even if the variable is volatile to avoid memory model concerns of staleness, you’d still have three distinct operations, with the possibility of being pre-empted between … Read more