title: Thread safe static variables objective c
body: <p>Is there a way in objective C that I can define a static int that is thread safe?</p>
  
  <p>for example if I have class called Session that has:</p>
  
  <pre><code>static unsigned int session_id = 1000;
  
  - (int) generateSessionID{
          return session_id++;
  }
  </code></pre>
  
  <p>I am constructing session objects from different threads, each session object 
  should have a unique id. </p>