现在的位置: 首页 > 综合 > 正文

Plain Explanation of “memory_order”

2014年06月25日 ⁄ 综合 ⁄ 共 745字 ⁄ 字号 评论关闭
  • memory_order_acquire: guarantees that subsequent loads are not moved before the current load or any preceding loads.
  • memory_order_release: preceding stores are not moved past the current store or any subsequent stores.
  • memory_order_acq_rel: combines the two previous guarantees.
  • memory_order_consume: potentially weaker form of memory_order_acquire that enforces ordering of the current load before other operations that are data-dependent on it (for instance, when a load of a pointer
    is marked memory_order_consume, subsequent operations that dereference this pointer won’t be moved before it (yes, even that is not guaranteed on all platforms!).
  • memory_order_relaxed: all reorderings are okay.
One can see more information about memory order from a paper called Shared Memory Consistency Models: A Tutorial

抱歉!评论已关闭.