I'm translating a small C++ snippet to java, and I'm not 100% confident around memory orderings/fences. Is this correct:
C++:
std::atomic<size_t> seq;
...
seq.store(1,std::memory_order_release);
...
seq.load(std::memory_order_acquire);
How I think it should translate to Java:
unsafe.putLong(addr,1);
unsafe.storeFence();
unsafe.getLong(addr);
unsafe.loadFence();
Is this along the right lines? (and yes there is a reason for using unsafe vs just using an AtomicLong)