<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 726</TITLE>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<STYLE TYPE="text/css">
  INS { text-decoration:none; font-weight:bold; background-color:#A0FFA0 }
  .INS { text-decoration:none; background-color:#D0FFD0 }
  DEL { text-decoration:line-through; background-color:#FFA0A0 }
  .DEL { text-decoration:line-through; background-color: #FFD0D0 }
  @media (prefers-color-scheme: dark) {
    HTML { background-color:#202020; color:#f0f0f0; }
    A { color:#5bc0ff; }
    A:visited { color:#c6a8ff; }
    A:hover, a:focus { color:#afd7ff; }
    INS { background-color:#033a16; color:#aff5b4; }
    .INS { background-color: #033a16; }
    DEL { background-color:#67060c; color:#ffdcd7; }
    .DEL { background-color:#67060c; }
  }
  SPAN.cmnt { font-family:Times; font-style:italic }
</STYLE>
</HEAD>
<BODY>
<P><EM>This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21
  Core Issues List revision 118b.
  See http://www.open-std.org/jtc1/sc22/wg21/ for the official
  list.</EM></P>
<P>2025-09-28</P>
<HR>
<A NAME="726"></A><H4>726.
  
Atomic and non-atomic objects in the memory model
</H4>
<B>Section: </B>6.10.2&#160; [<A href="https://wg21.link/intro.multithread">intro.multithread</A>]
 &#160;&#160;&#160;

 <B>Status: </B>CD2
 &#160;&#160;&#160;

 <B>Submitter: </B>Clark Nelson
 &#160;&#160;&#160;

 <B>Date: </B>30 September, 2008<BR>


<P>[Voted into WP at October, 2009 meeting.]</P>

<P>In general, the description of the memory model is very careful to
specify when the objects under discussion are atomic or
non-atomic. However, there are a few cases where it could be
clearer.</P>

<P><B>Proposed resolution (March, 2009):</B></P>

<OL>
<LI><P>Modify 6.10.2 [<A href="https://wg21.link/intro.multithread#5">intro.multithread</A>] paragraph 5 as follows:</P></LI>

<BLOCKQUOTE>

All modifications to a particular atomic object <I>M</I>
occur in some particular total order, called the
<I>modification order of M</I>. If <I>A</I> and <I>B</I> are
modifications of an atomic object <I>M</I> and <I>A</I> happens before
(as defined below) <I>B</I>, then <I>A</I> shall precede <I>B</I> in
the modification order of <I>M</I>, which is defined below.
[<I>Note:</I> This states that the modification orders must respect
<I>happens before</I>.  &#8212;<I>end note</I>] [<I>Note:</I> There is
a separate order for each <DEL>scalar</DEL> <INS>atomic</INS> object.  There
is no requirement that these can be combined into a single total order
for all objects.  In general this will be impossible since different
threads may observe modifications to different variables in
inconsistent orders. &#8212;<I>end note</I>]

</BLOCKQUOTE>

<LI><P>Modify 6.10.2 [<A href="https://wg21.link/intro.multithread#7">intro.multithread</A>] paragraph 7 as follows:</P></LI>

<BLOCKQUOTE>

Certain library calls <I>synchronize with</I> other library calls
performed by another thread.  In particular, an atomic operation
<I>A</I> that performs a release operation on an <INS>atomic</INS> object
<I>M</I> synchronizes with an atomic operation <I>B</I> that performs
an acquire operation on <I>M</I> and reads a value written by any side
effect in the release sequence headed by <I>A</I>...

</BLOCKQUOTE>

<LI><P>Modify 6.10.2 [<A href="https://wg21.link/intro.multithread#12">intro.multithread</A>] paragraph 12 as follows:</P></LI>

<BLOCKQUOTE>

<P>A <I>visible side effect A</I> on <DEL>an</DEL> <INS>a scalar</INS>
object <INS>or bit-field</INS> <I>M</I> with respect to a value
computation <I>B</I> of <I>M</I> satisfies the conditions:</P>

<UL>
<LI><P>
<I>A</I> happens before <I>B</I>, and</P></LI>

<LI><P>there is no other side effect <I>X</I> to <I>M</I> such that
<I>A</I> happens before <I>X</I> and <I>X</I> happens before
<I>B</I>.</P></LI>

</UL>

<P>The value of a non-atomic scalar object <INS>or bit-field</INS>
<I>M</I>, as determined by evaluation <I>B</I>, shall be the value
stored by the visible side effect <I>A</I>. [<I>Note:</I> If there is
ambiguity about which side effect to a non-atomic object <INS>or
bit-field</INS> is visible, then there is a data race, and the
behavior is undefined.  &#8212;<I>end note</I>] ...</P>

</BLOCKQUOTE>

</OL>

<BR><BR>
</BODY>
</HTML>
