std::mem_order_consume

This lesson introduces std::mem_order_consume which is used for concurrency in C++.

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 being revised, and the use of memory_order_consume is temporarily discouraged.”

How can it be that a compiler that implements the C++11 standard doesn’t support the memory model std::memory_order_consume? The answer is that the compiler maps std::memory_order_consume to std::memory_order_acquire. This ...