|
419 | 419 | \end{note}
|
420 | 420 |
|
421 | 421 | \pnum
|
422 |
| -An atomic operation \placeholder{A} that performs a release operation on an atomic |
423 |
| -object \placeholder{M} synchronizes with an atomic operation \placeholder{B} that performs |
424 |
| -an acquire operation on \placeholder{M} and takes its value from any side effect in the |
425 |
| -release sequence headed by \placeholder{A}. |
| 422 | +An atomic operation $A$ that performs a release operation on an atomic |
| 423 | +object $M$ synchronizes with an atomic operation $B$ that performs |
| 424 | +an acquire operation on $M$ and takes its value from any side effect in the |
| 425 | +release sequence headed by $A$. |
426 | 426 |
|
427 | 427 | \pnum
|
428 |
| -An atomic operation \placeholder{A} on some atomic object \placeholder{M} is |
| 428 | +An atomic operation $A$ on some atomic object $M$ is |
429 | 429 | \defn{coherence-ordered before}
|
430 |
| -another atomic operation \placeholder{B} on \placeholder{M} if |
| 430 | +another atomic operation $B$ on $M$ if |
431 | 431 | \begin{itemize}
|
432 |
| -\item \placeholder{A} is a modification, and |
433 |
| -\placeholder{B} reads the value stored by \placeholder{A}, or |
434 |
| -\item \placeholder{A} precedes \placeholder{B} |
435 |
| -in the modification order of \placeholder{M}, or |
436 |
| -\item \placeholder{A} and \placeholder{B} are not |
| 432 | +\item $A$ is a modification, and |
| 433 | +$B$ reads the value stored by $A$, or |
| 434 | +\item $A$ precedes $B$ |
| 435 | +in the modification order of $M$, or |
| 436 | +\item $A$ and $B$ are not |
437 | 437 | the same atomic read-modify-write operation, and
|
438 |
| -there exists an atomic modification \placeholder{X} of \placeholder{M} |
439 |
| -such that \placeholder{A} reads the value stored by \placeholder{X} and |
440 |
| -\placeholder{X} precedes \placeholder{B} |
441 |
| -in the modification order of \placeholder{M}, or |
442 |
| -\item there exists an atomic modification \placeholder{X} of \placeholder{M} |
443 |
| -such that \placeholder{A} is coherence-ordered before \placeholder{X} and |
444 |
| -\placeholder{X} is coherence-ordered before \placeholder{B}. |
| 438 | +there exists an atomic modification $X$ of $M$ |
| 439 | +such that $A$ reads the value stored by $X$ and |
| 440 | +$X$ precedes $B$ |
| 441 | +in the modification order of $M$, or |
| 442 | +\item there exists an atomic modification $X$ of $M$ |
| 443 | +such that $A$ is coherence-ordered before $X$ and |
| 444 | +$X$ is coherence-ordered before $B$. |
445 | 445 | \end{itemize}
|
446 | 446 |
|
447 | 447 | \pnum
|
448 |
| -There is a single total order \placeholder{S} |
| 448 | +There is a single total order $S$ |
449 | 449 | on all \tcode{memory_order::seq_cst} operations, including fences,
|
450 | 450 | that satisfies the following constraints.
|
451 |
| -First, if \placeholder{A} and \placeholder{B} are |
| 451 | +First, if $A$ and $B$ are |
452 | 452 | \tcode{memory_order::seq_cst} operations and
|
453 |
| -\placeholder{A} strongly happens before \placeholder{B}, |
454 |
| -then \placeholder{A} precedes \placeholder{B} in \placeholder{S}. |
455 |
| -Second, for every pair of atomic operations \placeholder{A} and |
456 |
| -\placeholder{B} on an object \placeholder{M}, |
457 |
| -where \placeholder{A} is coherence-ordered before \placeholder{B}, |
458 |
| -the following four conditions are required to be satisfied by \placeholder{S}: |
| 453 | +$A$ strongly happens before $B$, |
| 454 | +then $A$ precedes $B$ in $S$. |
| 455 | +Second, for every pair of atomic operations $A$ and |
| 456 | +$B$ on an object $M$, |
| 457 | +where $A$ is coherence-ordered before $B$, |
| 458 | +the following four conditions are required to be satisfied by $S$: |
459 | 459 | \begin{itemize}
|
460 |
| -\item if \placeholder{A} and \placeholder{B} are both |
| 460 | +\item if $A$ and $B$ are both |
461 | 461 | \tcode{memory_order::seq_cst} operations,
|
462 |
| -then \placeholder{A} precedes \placeholder{B} in \placeholder{S}; and |
463 |
| -\item if \placeholder{A} is a \tcode{memory_order::seq_cst} operation and |
464 |
| -\placeholder{B} happens before |
465 |
| -a \tcode{memory_order::seq_cst} fence \placeholder{Y}, |
466 |
| -then \placeholder{A} precedes \placeholder{Y} in \placeholder{S}; and |
467 |
| -\item if a \tcode{memory_order::seq_cst} fence \placeholder{X} |
468 |
| -happens before \placeholder{A} and |
469 |
| -\placeholder{B} is a \tcode{memory_order::seq_cst} operation, |
470 |
| -then \placeholder{X} precedes \placeholder{B} in \placeholder{S}; and |
471 |
| -\item if a \tcode{memory_order::seq_cst} fence \placeholder{X} |
472 |
| -happens before \placeholder{A} and |
473 |
| -\placeholder{B} happens before |
474 |
| -a \tcode{memory_order::seq_cst} fence \placeholder{Y}, |
475 |
| -then \placeholder{X} precedes \placeholder{Y} in \placeholder{S}. |
| 462 | +then $A$ precedes $B$ in $S$; and |
| 463 | +\item if $A$ is a \tcode{memory_order::seq_cst} operation and |
| 464 | +$B$ happens before |
| 465 | +a \tcode{memory_order::seq_cst} fence $Y$, |
| 466 | +then $A$ precedes $Y$ in $S$; and |
| 467 | +\item if a \tcode{memory_order::seq_cst} fence $X$ |
| 468 | +happens before $A$ and |
| 469 | +$B$ is a \tcode{memory_order::seq_cst} operation, |
| 470 | +then $X$ precedes $B$ in $S$; and |
| 471 | +\item if a \tcode{memory_order::seq_cst} fence $X$ |
| 472 | +happens before $A$ and |
| 473 | +$B$ happens before |
| 474 | +a \tcode{memory_order::seq_cst} fence $Y$, |
| 475 | +then $X$ precedes $Y$ in $S$. |
476 | 476 | \end{itemize}
|
477 | 477 |
|
478 | 478 | \pnum
|
479 | 479 | \begin{note}
|
480 |
| -This definition ensures that \placeholder{S} is consistent with |
481 |
| -the modification order of any atomic object \placeholder{M}. |
| 480 | +This definition ensures that $S$ is consistent with |
| 481 | +the modification order of any atomic object $M$. |
482 | 482 | It also ensures that
|
483 |
| -a \tcode{memory_order::seq_cst} load \placeholder{A} of \placeholder{M} |
484 |
| -gets its value either from the last modification of \placeholder{M} |
485 |
| -that precedes \placeholder{A} in \placeholder{S} or |
486 |
| -from some non-\tcode{memory_order::seq_cst} modification of \placeholder{M} |
487 |
| -that does not happen before any modification of \placeholder{M} |
488 |
| -that precedes \placeholder{A} in \placeholder{S}. |
| 483 | +a \tcode{memory_order::seq_cst} load $A$ of $M$ |
| 484 | +gets its value either from the last modification of $M$ |
| 485 | +that precedes $A$ in $S$ or |
| 486 | +from some non-\tcode{memory_order::seq_cst} modification of $M$ |
| 487 | +that does not happen before any modification of $M$ |
| 488 | +that precedes $A$ in $S$. |
489 | 489 | \end{note}
|
490 | 490 |
|
491 | 491 | \pnum
|
492 | 492 | \begin{note}
|
493 |
| -We do not require that \placeholder{S} be consistent with |
| 493 | +We do not require that $S$ be consistent with |
494 | 494 | ``happens before''\iref{intro.races}.
|
495 | 495 | This allows more efficient implementation
|
496 | 496 | of \tcode{memory_order::acquire} and \tcode{memory_order::release}
|
|
3522 | 3522 | fence}.
|
3523 | 3523 |
|
3524 | 3524 | \pnum
|
3525 |
| -A release fence \placeholder{A} synchronizes with an acquire fence \placeholder{B} if there exist |
3526 |
| -atomic operations \placeholder{X} and \placeholder{Y}, both operating on some atomic object |
3527 |
| -\placeholder{M}, such that \placeholder{A} is sequenced before \placeholder{X}, \placeholder{X} modifies |
3528 |
| -\placeholder{M}, \placeholder{Y} is sequenced before \placeholder{B}, and \placeholder{Y} reads the value |
3529 |
| -written by \placeholder{X} or a value written by any side effect in the hypothetical release |
3530 |
| -sequence \placeholder{X} would head if it were a release operation. |
| 3525 | +A release fence $A$ synchronizes with an acquire fence $B$ if there exist |
| 3526 | +atomic operations $X$ and $Y$, both operating on some atomic object |
| 3527 | +$M$, such that $A$ is sequenced before $X$, $X$ modifies |
| 3528 | +$M$, $Y$ is sequenced before $B$, and $Y$ reads the value |
| 3529 | +written by $X$ or a value written by any side effect in the hypothetical release |
| 3530 | +sequence $X$ would head if it were a release operation. |
3531 | 3531 |
|
3532 | 3532 | \pnum
|
3533 |
| -A release fence \placeholder{A} synchronizes with an atomic operation \placeholder{B} that |
3534 |
| -performs an acquire operation on an atomic object \placeholder{M} if there exists an atomic |
3535 |
| -operation \placeholder{X} such that \placeholder{A} is sequenced before \placeholder{X}, \placeholder{X} |
3536 |
| -modifies \placeholder{M}, and \placeholder{B} reads the value written by \placeholder{X} or a value |
3537 |
| -written by any side effect in the hypothetical release sequence \placeholder{X} would head if |
| 3533 | +A release fence $A$ synchronizes with an atomic operation $B$ that |
| 3534 | +performs an acquire operation on an atomic object $M$ if there exists an atomic |
| 3535 | +operation $X$ such that $A$ is sequenced before $X$, $X$ |
| 3536 | +modifies $M$, and $B$ reads the value written by $X$ or a value |
| 3537 | +written by any side effect in the hypothetical release sequence $X$ would head if |
3538 | 3538 | it were a release operation.
|
3539 | 3539 |
|
3540 | 3540 | \pnum
|
3541 |
| -An atomic operation \placeholder{A} that is a release operation on an atomic object |
3542 |
| -\placeholder{M} synchronizes with an acquire fence \placeholder{B} if there exists some atomic |
3543 |
| -operation \placeholder{X} on \placeholder{M} such that \placeholder{X} is sequenced before \placeholder{B} |
3544 |
| -and reads the value written by \placeholder{A} or a value written by any side effect in the |
3545 |
| -release sequence headed by \placeholder{A}. |
| 3541 | +An atomic operation $A$ that is a release operation on an atomic object |
| 3542 | +$M$ synchronizes with an acquire fence $B$ if there exists some atomic |
| 3543 | +operation $X$ on $M$ such that $X$ is sequenced before $B$ |
| 3544 | +and reads the value written by $A$ or a value written by any side effect in the |
| 3545 | +release sequence headed by $A$. |
3546 | 3546 |
|
3547 | 3547 | \indexlibraryglobal{atomic_thread_fence}%
|
3548 | 3548 | \begin{itemdecl}
|
|
0 commit comments