Data dependencies with std::memory_order_consume
Explore how std::memory_order_consume handles data dependencies within and between threads using atomic operations for proper synchronization. Understand concepts like carries-a-dependency-to and dependency-ordered-before, and recognize potential race conditions with non-atomic variables in concurrent C++ code to ensure correct program behavior.
We'll cover the following...
We'll cover the following...
std::memory_order_consume deals with data dependencies on atomics; these data dependencies exist in two ways. First, let us look at carries-a-dependency-to in a thread and dependency-ordered before between two threads. Both dependencies introduce a happens-before relation. These are the kind of relations we are looking for. What does carries-a-dependency-to and dependency-order-before mean?