title: Local static variables for each thread
body: <p>Lets say I have a class that after initialization creates a thread and runs a method in it, within it declares a static variable:</p>
  
  <pre><code>void method()
  {
       static int var = 0;
       var++;
  }
  </code></pre>
  
  <p>If I create more objects of the class, for example 3, then the method will be called 3 times in 3 different threads. After that <code>var</code> will equal 3.
  How to accomplish the functionality, where each thread has its own static <code>var</code> that is independent of others. I would appreciate all help.</p>