title: Is the ++ operator thread safe?
body: <p><em>NOTE: I am really not very good at Multithreaded programming, but my current project has me doing it so I am trying to get my head around what is thread safe and what is not.</em></p>
  
  <p>I was reading one of Eric Lippert's <a href="https://stackoverflow.com/questions/3346450/c-what-is-the-difference-between-i-and-i/3346729#3346729">awesome answers on what ++i does</a>.  He says this is what really happens:</p>
  
  <ol>
  <li>x is evaluated to produce the variable</li>
  <li>the value of the variable is copied to a temporary location</li>
  <li>the temporary value is incremented to produce a new value (not overwriting the temporary!)</li>
  <li>the new value is stored in the variable</li>
  <li>the result of the operation is the new value</li>
  </ol>
  
  <p>This got me to thinking, what if two threads where calling ++i?  If the first thread is at step 3 when the second thread is on step 2.  (Meaning what if the second thread copies the value off to the temp location before the first thread stores the new value in the variable?)</p>
  
  <p>If that happens then it would seem that both threads would only increment <code>i</code> once instead of twice.  (Unless the whole thing is in a <code>lock</code>.)</p>