title: How to atomically perform sequential load and store operations?
body: <p>Consider this code under GCC 4.8.0:</p>
  
  <pre><code>std::atomic&lt;bool&gt; a;
  std::atomic&lt;bool&gt; b;
  
  a.store( b.load() ); // want to be atomic
  </code></pre>
  
  <p>How can I make the line above to be atomic as whole? In other words, how to obtain atomic assignment of atomic variables?</p>
  
  <p>Are there any alternatives for <code>std::atomic</code> which allow this?</p>
  
  <hr>
  
  <p>I have found <code>__transaction_atomic {/* any code goes here */}</code> which is activated on GCC by <code>-fgnu-tm</code>. With this, one can write anything in the block and it will be performed atomically.</p>
  
  <p>Now the question are:</p>
  
  <p>Is <code>__transaction_atomic</code> implemented with mutexes? If yes, then what the mutex actually locks?</p>
  
  <p>Does the implementation of <code>__transaction_atomic</code> change depending on what is in it's block? If yes, then how it changes?</p>