Synchronizes-with relation
A synchronizes-with relation is an inter-thread ordering relationship in which a synchronization operation establishes visibility of effects from one thread to another.
C++ Concurrency in Action, Second Edition
A C++ memory-model relation between operations that establishes inter-thread ordering and visibility.
- How it is used
- Establishes cross-thread ordering so a reader can safely access data published before an observed atomic operation.
- How deep it goes
- Works through observing loads, memory-order choices, release sequences, and acquire placement in a lock-free stack.
- Examples
- Traces a vector and readiness flag, a multi-consumer queue, and a lock-free stack.
- What you can do after
- Diagnose/debug with it whether an observed atomic value actually orders earlier writes before later reads.
Read how C++ Concurrency in Action, Second Edition explains synchronizes-with relation →
Modern C, Third Edition
A synchronizes-with relation is an ordering relationship in which an acquire evaluation reads a value written by a release evaluation in another thread.
- How it is used
- Explains how atomic reads and writes establish ordering and visibility between concurrent threads.
- How deep it goes
- Defines the relation through modification order and concrete reads, without developing a complete memory-model formalism.
- Examples
- Uses atomic x across two threads and an atomic finished flag coordinating input and account threads.
- What you can do after
- Evaluate/understand when an atomic read observes another thread's write and thereby orders earlier modifications.
Read how Modern C, Third Edition explains synchronizes-with relation →
Modern C
A synchronizes-with relation orders evaluations in different threads when a synchronization operation in one thread observes the result of a corresponding operation in another.
- How it is used
- Orders evaluations across threads when atomic operations or specified C library calls provide synchronization.
- How deep it goes
- Defines observed-write synchronization and modification order, while deferring detailed treatment of C library synchronization.
- Examples
- Uses an atomic x whose threads observe values 31 and 5 written by one another.
- What you can do after
- Evaluate whether two threads synchronize by checking whether one atomic operation observes the other’s written value.
Related concepts
- happens-before relationproduces · A happens-before relation is a partial ordering between events that establishes when one causally precedes another for reasoning about execution and effects.
- thread-aware memory modelpart of · A programming-language memory model that defines how operations on memory behave and become visible across threads.
- memory barrierproduced by · A memory barrier is a synchronization operation that constrains the ordering or visibility of memory accesses across concurrent execution.
- inter-thread orderingproduces · Inter-thread ordering is a defined precedence relationship between accesses performed by separate threads.
- atomic operationproduced by · An atomic operation accesses or updates shared state as an indivisible action with respect to concurrent operations.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


