c++11 - memory_relaxed and VarHandler -


in https://shipilev.net/blog/2016/close-encounters-of-jmm-kind/#myth-barriers-are-sane author wrote:

of course, without keeping reads in order, result 1, 0 trivially achievable. not make interesting test case. actual test clever that: uses new varhandles "opaque" access mode, inhibits these optimizations , exposes reads hardware in same order:[3]

and [3]:

  1. this sounds similar c/c++11 std::atomic(…​, memory_order_relaxed), modeled after. convenient hardware concurrency testing, in example.

i not sure author means because says

which inhibits these optimizations , exposes reads hardware in same order

whileas

memory_order_relaxed allows every reordering (it doesn't give special guarantees in memory ordering).


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -