Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added opaque operations to AtomicBuffer for int/long. An opaque loads/stores provides atomicity and visibility, but it doesn't provide any ordering guarantees beyond coherence. So it doesn't order loads/stores to different addresses (doesn't provide consistency), only to its own address (coherence). Opaque is very much like a C-style volatile and can be used in the same situation as the C++ memory_order_relaxed.
For more info see:
https://gee.cs.oswego.edu/dl/html/j9mm.html
Opaque operations are great for performance counters or progress indicators and provide the least amount of overhead on the CPU (all modern CPUs are coherent); especially ISA's with a weak memory model like ARM or RISC-V. It provides less value on the X86 since every store is a release store and every load is an acquire load.
Opaque is great for single writer multiple reader scenario's.
Idea:
Instead of using the naming 'opaque', the name 'relaxed' could be an idea. With relaxed coming from memory_order_relaxed.