Skip to content

Commit 608248a

Browse files
committed
[intro.races] Clarify 'synchronization operation'.
Fixes CWG 2297.
1 parent 58382cb commit 608248a

File tree

1 file changed

+24
-34
lines changed

1 file changed

+24
-34
lines changed

source/basic.tex

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4655,35 +4655,37 @@
46554655
memory location.
46564656

46574657
\pnum
4658-
The library defines a number of atomic operations\iref{atomics} and
4659-
operations on mutexes\iref{thread} that are specially identified as
4660-
synchronization operations. These operations play a special role in making
4661-
assignments in one thread visible to another. A synchronization operation on one
4662-
or more memory locations is either a consume operation, an acquire operation, a
4663-
release operation, or both an acquire and release operation. A synchronization
4664-
operation without an associated memory location is a fence and can be either an
4665-
acquire fence, a release fence, or both an acquire and release fence. In
4666-
addition, there are relaxed atomic operations, which are not synchronization
4667-
operations, and atomic read-modify-write operations, which have special
4668-
characteristics. \begin{note} For example, a call that acquires a mutex will
4658+
All modifications to a particular atomic object \placeholder{M} occur in some
4659+
particular total order, called the \defn{modification order} of \placeholder{M}.
4660+
\begin{note} There is a separate order for each
4661+
atomic object. There is no requirement that these can be combined into a single
4662+
total order for all objects. In general this will be impossible since different
4663+
threads may observe modifications to different objects in inconsistent orders.
4664+
\end{note}
4665+
4666+
\pnum
4667+
Certain library calls \defn{synchronize with} other library calls performed by
4668+
another thread.
4669+
Such calls are also known as
4670+
\defnx{synchronization operations}{synchronization operation}.
4671+
\begin{note} Except in the specified cases, reading a later value does not
4672+
necessarily ensure visibility as described below. Such a requirement would
4673+
sometimes interfere with efficient implementation. \end{note} \begin{note} The
4674+
specifications of the synchronization operations
4675+
(\ref{support.signal}, \ref{util.smartptr.atomic}, \ref{atomics.order},
4676+
\ref{atomics.fences}, \ref{thread}) define when one reads the value
4677+
written by another. For atomic objects, the definition is clear.
4678+
A call that acquires a mutex will
46694679
perform an acquire operation on the locations comprising the mutex.
46704680
Correspondingly, a call that releases the same mutex will perform a release
46714681
operation on those same locations. Informally, performing a release operation on
46724682
\placeholder{A} forces prior
46734683
\indextext{side effects}%
46744684
side effects on other memory locations to become visible
46754685
to other threads that later perform a consume or an acquire operation on
4676-
\placeholder{A}. ``Relaxed'' atomic operations are not synchronization operations even
4677-
though, like synchronization operations, they cannot contribute to data races.
4678-
\end{note}
4679-
4680-
\pnum
4681-
All modifications to a particular atomic object \placeholder{M} occur in some
4682-
particular total order, called the \defn{modification order} of \placeholder{M}.
4683-
\begin{note} There is a separate order for each
4684-
atomic object. There is no requirement that these can be combined into a single
4685-
total order for all objects. In general this will be impossible since different
4686-
threads may observe modifications to different objects in inconsistent orders.
4686+
\placeholder{A}. ``Relaxed'' atomic operations are not synchronization
4687+
operations even though, like synchronization operations, they cannot
4688+
contribute to data races.
46874689
\end{note}
46884690

46894691
\pnum
@@ -4699,18 +4701,6 @@
46994701
\item is an atomic read-modify-write operation.
47004702
\end{itemize}
47014703

4702-
\pnum
4703-
Certain library calls \defn{synchronize with} other library calls performed by
4704-
another thread. For example, an atomic store-release synchronizes with a
4705-
load-acquire that takes its value from the store\iref{atomics.order}.
4706-
\begin{note} Except in the specified cases, reading a later value does not
4707-
necessarily ensure visibility as described below. Such a requirement would
4708-
sometimes interfere with efficient implementation. \end{note} \begin{note} The
4709-
specifications of the synchronization operations define when one reads the value
4710-
written by another. For atomic objects, the definition is clear. All operations
4711-
on a given mutex occur in a single total order. Each mutex acquisition ``reads
4712-
the value written'' by the last mutex release. \end{note}
4713-
47144704
\pnum
47154705
An evaluation \placeholder{A} \defn{carries a dependency} to an evaluation \placeholder{B} if
47164706

0 commit comments

Comments
 (0)