Skip to content

Commit 0329df5

Browse files
committed
[intro.races] Clarify 'synchronization operation'.
Fixes CWG 2297.
1 parent 66a540e commit 0329df5

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
@@ -4624,35 +4624,37 @@
46244624
memory location.
46254625

46264626
\pnum
4627-
The library defines a number of atomic operations\iref{atomics} and
4628-
operations on mutexes\iref{thread} that are specially identified as
4629-
synchronization operations. These operations play a special role in making
4630-
assignments in one thread visible to another. A synchronization operation on one
4631-
or more memory locations is either a consume operation, an acquire operation, a
4632-
release operation, or both an acquire and release operation. A synchronization
4633-
operation without an associated memory location is a fence and can be either an
4634-
acquire fence, a release fence, or both an acquire and release fence. In
4635-
addition, there are relaxed atomic operations, which are not synchronization
4636-
operations, and atomic read-modify-write operations, which have special
4637-
characteristics. \begin{note} For example, a call that acquires a mutex will
4627+
All modifications to a particular atomic object \placeholder{M} occur in some
4628+
particular total order, called the \defn{modification order} of \placeholder{M}.
4629+
\begin{note} There is a separate order for each
4630+
atomic object. There is no requirement that these can be combined into a single
4631+
total order for all objects. In general this will be impossible since different
4632+
threads may observe modifications to different objects in inconsistent orders.
4633+
\end{note}
4634+
4635+
\pnum
4636+
Certain library calls \defn{synchronize with} other library calls performed by
4637+
another thread
4638+
(\ref{support.signal}, \ref{util.smartptr.atomic}, \ref{atomics.order},
4639+
\ref{atomics.fences}, \ref{thread}).
4640+
Such calls are also known as
4641+
\defnx{synchronization operations}{synchronization operation}.
4642+
\begin{note} Except in the specified cases, reading a later value does not
4643+
necessarily ensure visibility as described below. Such a requirement would
4644+
sometimes interfere with efficient implementation. \end{note} \begin{note} The
4645+
specifications of the synchronization operations define when one reads the value
4646+
written by another. For atomic objects, the definition is clear.
4647+
A call that acquires a mutex will
46384648
perform an acquire operation on the locations comprising the mutex.
46394649
Correspondingly, a call that releases the same mutex will perform a release
46404650
operation on those same locations. Informally, performing a release operation on
46414651
\placeholder{A} forces prior
46424652
\indextext{side effects}%
46434653
side effects on other memory locations to become visible
46444654
to other threads that later perform a consume or an acquire operation on
4645-
\placeholder{A}. ``Relaxed'' atomic operations are not synchronization operations even
4646-
though, like synchronization operations, they cannot contribute to data races.
4647-
\end{note}
4648-
4649-
\pnum
4650-
All modifications to a particular atomic object \placeholder{M} occur in some
4651-
particular total order, called the \defn{modification order} of \placeholder{M}.
4652-
\begin{note} There is a separate order for each
4653-
atomic object. There is no requirement that these can be combined into a single
4654-
total order for all objects. In general this will be impossible since different
4655-
threads may observe modifications to different objects in inconsistent orders.
4655+
\placeholder{A}. ``Relaxed'' atomic operations are not synchronization
4656+
operations even though, like synchronization operations, they cannot
4657+
contribute to data races.
46564658
\end{note}
46574659

46584660
\pnum
@@ -4668,18 +4670,6 @@
46684670
\item is an atomic read-modify-write operation.
46694671
\end{itemize}
46704672

4671-
\pnum
4672-
Certain library calls \defn{synchronize with} other library calls performed by
4673-
another thread. For example, an atomic store-release synchronizes with a
4674-
load-acquire that takes its value from the store\iref{atomics.order}.
4675-
\begin{note} Except in the specified cases, reading a later value does not
4676-
necessarily ensure visibility as described below. Such a requirement would
4677-
sometimes interfere with efficient implementation. \end{note} \begin{note} The
4678-
specifications of the synchronization operations define when one reads the value
4679-
written by another. For atomic objects, the definition is clear. All operations
4680-
on a given mutex occur in a single total order. Each mutex acquisition ``reads
4681-
the value written'' by the last mutex release. \end{note}
4682-
46834673
\pnum
46844674
An evaluation \placeholder{A} \defn{carries a dependency} to an evaluation \placeholder{B} if
46854675

0 commit comments

Comments
 (0)