Add a more formal explanation of happens-before

pull/378/head
SabrinaJewson 2 years ago
parent 8068390a90
commit 3c76e35449
No known key found for this signature in database
GPG Key ID: 3D5438FFA5F05564

@ -210,6 +210,13 @@ possible execution, Thread 1s `store` synchronizes-with Thread 2s `load`,
which causes that `store` and everything sequenced before it to happen-before which causes that `store` and everything sequenced before it to happen-before
the `load` and everything sequenced after it. the `load` and everything sequenced after it.
> More formally, we can say that A happens-before B if any of the following
> conditions are true:
> 1. A is sequenced-before B (i.e. A occurs before B on the same thread)
> 2. A synchronizes-with B (i.e. A is a `Release` operation and B is an
> `Acquire` operation that reads the value written by A)
> 3. A happens-before X, and X happens-before B (transitivity)
There is one more rule required for these to be useful, and that is _release There is one more rule required for these to be useful, and that is _release
sequences_: after a release store is performed on an atomic, happens-before sequences_: after a release store is performed on an atomic, happens-before
arrows will connect together each subsequent value of the atomic as long as the arrows will connect together each subsequent value of the atomic as long as the

Loading…
Cancel
Save