A synchronizes-with relation orders evaluations across threads: an acquire evaluation synchronizes with a release evaluation when it reads the value written by that evaluation. For atomic objects, the write is known to have happened before the corresponding read. section 21.1
Two threads sharing an atomic
Suppose thread A modifies atomic x and thread B later reads the value that A wrote. That read synchronizes with A's modification. The same pattern appears when one thread writes true to an atomic finished flag and another thread observes true: the observing thread can then see modifications made before the write. section 21.1
The relation is illustrated through these rules:
- Atomic modifications have a modification order consistent with each thread's sequenced-before order. section 21.1
- A read synchronizes when it observes a value written by another thread's modification. section 21.1
- If competing threads write the same atomic flag, one write occurs first, and a later observing read can establish the ordering. section 21.1
Figure 21.1 Two threads that synchronize via an atomic. The circles present the modifications of object x. The bars below the threads represent information about the state of A, and those above represent information about the state of B.
Use the figure to trace modifications of atomic x and identify where the two threads synchronize. section 21.1


