Shared atomic variable is not properly published if it is not modified under mutex
<p>I am reading about std::condition_variable on <a href="http://en.cppreference.com/w/cpp/thread/condition_variable" rel="noreferrer">http://en.cppreference.com/w/cpp/thread/condition_variable</a> and I don't understand this:</p>

<blockquote>
  <p>Even if the shared variable is atomic, it must be modified under the
  mutex in order to correctly publish the modification to the waiting
  thread.</p>
</blockquote>

<p>Why a shared atomic variable is not properly published if it is not modified under mutex? How to understand this statement?</p>

<p>On another page <a href="http://en.cppreference.com/w/cpp/atomic/atomic" rel="noreferrer">http://en.cppreference.com/w/cpp/atomic/atomic</a> there is a statement that seems to contradict to the the first statement:</p>

<blockquote>
  <p>If one thread writes to an atomic object while another thread reads
  from it, the behavior is well-defined (see memory model for details on
  data races)</p>
</blockquote>