title: Whats the equivalent of synchronized in Objective-C?
body: <p>What is the equivalent of java synchronized in objective c?
  I want to be able to make my singleton method safe, so when it's bein called from 2 different threads, they try to use it 1 by 1.</p>
  
  <pre><code>+(MyObject*) getSharedObject
  {
       if(!singleton)
       {
            singleton = [[MyObject alloc] init];
       }
       return singleton;
  }
  </code></pre>