title: Thread safety and local variables
body: <p>If I have a local variable like so:</p>
  
  <pre><code>Increment()
  {
      int i = getFromDb(); // get count for a customer from db 
  };
  </code></pre>
  
  <p>And this is an instance class which gets incremented (each time a customer - an instance object - makes a purchase), is this variable thread safe? I hear that local variables are thread safe because each thread gets its own stack, etc etc.</p>
  
  <p>Also, am I right in thinking that this variable is shared state? What I'm lacking in the thinking dept is that this variable will be working with different customer objects (e.g. John, Paul, etc) so is thread safe but this is flawed thinking and a bit of inexperience in concurrent programming. This sounds very naive, but then I don't have a lot of experience in concurrent coding like I do in general, synchronous coding.</p>
  
  <p>EDIT: Also, the function call getFromDb() isn't part of the question and I don't expect anyone to guess on its thread safety as it's just a call to indicate the value is assigned from a function which gets data from the db. :)</p>
  
  <p>EDIT 2: Also, getFromDb's thread safety is guaranteed as it only performs read operations.</p>