|
6319 | 6319 | operations on mutexes\iref{thread} that are specially identified as |
6320 | 6320 | synchronization operations. These operations play a special role in making |
6321 | 6321 | assignments in one thread visible to another. A synchronization operation on one |
6322 | | -or more memory locations is either a consume operation, an acquire operation, a |
| 6322 | +or more memory locations is either an acquire operation, a |
6323 | 6323 | release operation, or both an acquire and release operation. A synchronization |
6324 | 6324 | operation without an associated memory location is a fence and can be either an |
6325 | 6325 | acquire fence, a release fence, or both an acquire and release fence. In |
|
6375 | 6375 | the value written'' by the last mutex release. |
6376 | 6376 | \end{note} |
6377 | 6377 |
|
6378 | | -\pnum |
6379 | | -An evaluation $A$ \defn{carries a dependency} to an evaluation $B$ if |
6380 | | -\begin{itemize} |
6381 | | -\item |
6382 | | -the value of $A$ is used as an operand of $B$, unless: |
6383 | | -\begin{itemize} |
6384 | | -\item |
6385 | | -$B$ is an invocation of any specialization of |
6386 | | -\tcode{std::kill_dependency}\iref{atomics.order}, or |
6387 | | -\item |
6388 | | -$A$ is the left operand of a built-in logical \logop{and} (\tcode{\&\&}, |
6389 | | -see~\ref{expr.log.and}) or logical \logop{or} (\tcode{||}, see~\ref{expr.log.or}) |
6390 | | -operator, or |
6391 | | -\item |
6392 | | -$A$ is the left operand of a conditional (\tcode{?:}, see~\ref{expr.cond}) |
6393 | | -operator, or |
6394 | | -\item |
6395 | | -$A$ is the left operand of the built-in comma (\tcode{,}) |
6396 | | -operator\iref{expr.comma}; \end{itemize} or |
6397 | | -\item |
6398 | | -$A$ writes a scalar object or bit-field $M$, $B$ reads the value |
6399 | | -written by $A$ from $M$, and $A$ is sequenced before $B$, or |
6400 | | -\item |
6401 | | -for some evaluation $X$, $A$ carries a dependency to $X$, and |
6402 | | -$X$ carries a dependency to $B$. |
6403 | | -\end{itemize} |
6404 | | -\begin{note} |
6405 | | -``Carries a dependency to'' is a subset of ``is sequenced before'', |
6406 | | -and is similarly strictly intra-thread. |
6407 | | -\end{note} |
6408 | | - |
6409 | | -\pnum |
6410 | | -An evaluation $A$ is \defn{dependency-ordered before} an evaluation |
6411 | | -$B$ if |
6412 | | -\begin{itemize} |
6413 | | -\item |
6414 | | -$A$ performs a release operation on an atomic object $M$, and, in |
6415 | | -another thread, $B$ performs a consume operation on $M$ and reads |
6416 | | -the value written by $A$, or |
6417 | | - |
6418 | | -\item |
6419 | | -for some evaluation $X$, $A$ is dependency-ordered before $X$ and |
6420 | | -$X$ carries a dependency to $B$. |
6421 | | - |
6422 | | -\end{itemize} |
6423 | | -\begin{note} |
6424 | | -The relation ``is dependency-ordered before'' is analogous to |
6425 | | -``synchronizes with'', but uses release/consume in place of release/acquire. |
6426 | | -\end{note} |
6427 | | - |
6428 | | -\pnum |
6429 | | -An evaluation $A$ \defn{inter-thread happens before} an evaluation $B$ |
6430 | | -if |
6431 | | -\begin{itemize} |
6432 | | -\item |
6433 | | - $A$ synchronizes with $B$, or |
6434 | | -\item |
6435 | | - $A$ is dependency-ordered before $B$, or |
6436 | | -\item |
6437 | | - for some evaluation $X$ |
6438 | | - \begin{itemize} |
6439 | | - \item |
6440 | | - $A$ synchronizes with $X$ and $X$ |
6441 | | - is sequenced before $B$, or |
6442 | | - \item |
6443 | | - $A$ is sequenced before $X$ and $X$ |
6444 | | - inter-thread happens before $B$, or |
6445 | | - \item |
6446 | | - $A$ inter-thread happens before $X$ and $X$ |
6447 | | - inter-thread happens before $B$. |
6448 | | - \end{itemize} |
6449 | | -\end{itemize} |
6450 | | -\begin{note} |
6451 | | -The ``inter-thread happens before'' relation describes arbitrary |
6452 | | -concatenations of ``sequenced before'', ``synchronizes with'' and |
6453 | | -``dependency-ordered before'' relationships, with two exceptions. The first |
6454 | | -exception is that a concatenation never ends with |
6455 | | -``dependency-ordered before'' followed by ``sequenced before''. The reason for |
6456 | | -this limitation is that a consume operation participating in a |
6457 | | -``dependency-ordered before'' relationship provides ordering only with respect |
6458 | | -to operations to which this consume operation actually carries a dependency. The |
6459 | | -reason that this limitation applies only to the end of such a concatenation is |
6460 | | -that any subsequent release operation will provide the required ordering for a |
6461 | | -prior consume operation. The second exception is that a concatenation never |
6462 | | -consist entirely of ``sequenced before''. The reasons for this |
6463 | | -limitation are (1) to permit ``inter-thread happens before'' to be transitively |
6464 | | -closed and (2) the ``happens before'' relation, defined below, provides for |
6465 | | -relationships consisting entirely of ``sequenced before''. |
6466 | | -\end{note} |
6467 | | - |
6468 | 6378 | \pnum |
6469 | 6379 | An evaluation $A$ \defn{happens before} an evaluation $B$ |
6470 | | -(or, equivalently, $B$ \defn{happens after} $A$) if |
6471 | | -\begin{itemize} |
6472 | | -\item $A$ is sequenced before $B$, or |
6473 | | -\item $A$ inter-thread happens before $B$. |
6474 | | -\end{itemize} |
6475 | | -The implementation shall ensure that no program execution demonstrates a cycle |
6476 | | -in the ``happens before'' relation. |
6477 | | -\begin{note} |
6478 | | -This cycle would otherwise be |
6479 | | -possible only through the use of consume operations. |
6480 | | -\end{note} |
6481 | | - |
6482 | | -\pnum |
6483 | | -An evaluation $A$ \defn{simply happens before} an evaluation $B$ |
| 6380 | +(or, equivalently, $B$ happens after $A$) |
6484 | 6381 | if either |
6485 | 6382 | \begin{itemize} |
6486 | 6383 | \item $A$ is sequenced before $B$, or |
6487 | 6384 | \item $A$ synchronizes with $B$, or |
6488 | | -\item $A$ simply happens before $X$ and |
6489 | | -$X$ simply happens before $B$. |
| 6385 | +\item $A$ happens before $X$ and $X$ happens before $B$. |
6490 | 6386 | \end{itemize} |
6491 | 6387 | \begin{note} |
6492 | | -In the absence of consume operations, |
6493 | | -the happens before and simply happens before relations are identical. |
| 6388 | +An evaluation does not happen before itself. |
6494 | 6389 | \end{note} |
6495 | 6390 |
|
6496 | 6391 | \pnum |
|
6503 | 6398 | sequentially consistent atomic operations\iref{atomics.order}, or |
6504 | 6399 | \item there are evaluations $B$ and $C$ |
6505 | 6400 | such that $A$ is sequenced before $B$, |
6506 | | -$B$ simply happens before $C$, and |
| 6401 | +$B$ happens before $C$, and |
6507 | 6402 | $C$ is sequenced before $D$, or |
6508 | 6403 | \item there is an evaluation $B$ such that |
6509 | 6404 | $A$ strongly happens before $B$, and |
|
6512 | 6407 | \begin{note} |
6513 | 6408 | Informally, if $A$ strongly happens before $B$, |
6514 | 6409 | then $A$ appears to be evaluated before $B$ |
6515 | | -in all contexts. Strongly happens before excludes consume operations. |
| 6410 | +in all contexts. |
6516 | 6411 | \end{note} |
6517 | 6412 |
|
6518 | 6413 | \pnum |
|
0 commit comments