Sequenced-before relation
The sequenced-before relation is an ordering relation between evaluations within a single thread, as determined by the programming language’s execution rules.
C++ Concurrency in Action, Second Edition
A C++ ordering relation between evaluations within a single thread.
- How it is used
- Uses single-thread evaluation order to establish happens-before guarantees across threads through synchronization.
- How deep it goes
- Explains statement and expression ordering, then traces its composition with synchronization and acquire-release operations.
- Examples
- Uses function arguments with unspecified evaluation order and a spinlock protecting shared data.
- What you can do after
- Evaluate when operations are ordered within a thread and how that order carries across a synchronization boundary.
Read how C++ Concurrency in Action, Second Edition explains sequenced-before relation →
Modern C
The sequenced-before relation orders evaluations within a thread according to the C program's execution rules.
- How it is used
- Orders evaluations within one thread when reasoning about execution, correctness, and the consistency of observations.
- How deep it goes
- Defines the relation through a happened-before rule and a switch example, but defers cross-thread ordering to synchronization.
- Examples
- Uses a command[0] assignment before a switch and nested calls below ungetc to show an updated value being observed.
- What you can do after
- Evaluate within-thread ordering and determine when a later statement observes an earlier assignment.
Related concepts
- happens-before relationpart of · A happens-before relation is a partial ordering between events that establishes when one causally precedes another for reasoning about execution and effects.
- relationkind of · A relation is a rule or set of associations that links elements of one set with elements of another set without requiring unique outputs.
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.

