title: How to read two 32bit counters as a 64bit integer without race condition
body: <p>At memory 0x100 and 0x104 are two 32-bit counters. They represent a 64-bit timer and are constantly incrementing.</p>
  
  <p>How do I correctly read from two memory addresses and store the time as a 64-bit integer?</p>
  
  <p>One incorrect solution:</p>
  
  <pre><code>x = High
  y = Low
  result =  x &lt;&lt; 32 + y
  </code></pre>
  
  <p>(The program could be swapped out and in the meantime Low overflows...)</p>
  
  <p><strong>Additional requirements:</strong><br>
  Use C only, no assembly<br>
  The bus is 32-bit, so no way to read them in one instruction.<br>
  Your program may get context switched at any time.<br>
  No mutex or locks available.  </p>
  
  <p>Some high-level explanation is okay. Code not necessary. Thanks!</p>