title: How do I use the LOCK ASM prefix to read a value?
body: <p>I know how to use LOCK to thread-safely increment a value:</p>
  
  <pre><code>  lock inc     [J];
  </code></pre>
  
  <p>But how do I read [J] (or any value) in a thread-safe manner? The LOCK prefix can't be used with mov. And if I do the following:</p>
  
  <pre><code>  xor eax, eax;
    lock add eax, [J];
    mov [JC], eax;
  </code></pre>
  
  <p>It raises an error on line 2.</p>