Question

§ 1.10.11 of ISO/IEC 14882:2011 (C++ 11) defines the "inter-thread happens before" relation between evaluations, whose only difference from the "happens before" relation in § 1.10.12 is that A happens before B if A is sequenced before B but that is not sufficient for A inter-thread happens before B. Why is "inter-thread happens before" important enough to warrant a separate definition?

A note in § 1.10.11 suggests that "inter-thread happens before" doesn't allow evaluations whose only relation is "sequenced before" in part

to permit “inter-thread happens before” to be transitively closed

What does that mean? I know what a transitive closure is, and I know what it means for a set to be closed over some operation, but I've never heard of "transitively closed" and both Google and context are failing me.

Was it helpful?

Solution

"Inter-thread happens before" is defined purely for exposition. Note how "happens before" is defined as "sequenced before or inter-thread happens before", and the notion of "inter-thread happens before" is not used for anything else. "Sequenced before" describes evaluations happening on the same thread, "inter-thread happens before" applies to evaluations happening on different threads; "happens before" combines the two.

OTHER TIPS

The "transitively closed" remark simply means that the relation is transitive: if A inter-thread happens before B and B inter-thread happens before C, then A inter-thread happens before C.

That property doesn't hold if "sequenced before" alone qualifies as "inter-thread happens before" because of the first exclusion (of sequences ending in "dependency-ordered before" followed by "sequenced before").

This also means that "happens before" is not transitive; if A happens before B and B happens before C, it doesn't necessarily follow that A happens before C.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top