Search⌘ K
AI Features

std::mem_order_consume

Understand the challenges and current compiler behavior of std::memory_order_consume in C++. Learn how it compares with release-acquire ordering, the synchronization guarantees it provides, and why compilers map it to memory_order_acquire despite its intended weaker constraints.

Introduction

That is for two reasons that std::memory_order_consume is the most legendary of the six memory models: first, std::memory_order_consume is extremely hard to understand, and second - which may change in the future - no compiler currently supports it. With C++17 the situation gets even worse. Here is the official wording: “The specification of release-consume ordering is ...