title: What should my Objective-C singleton look like?
body: <p>My singleton accessor method is usually some variant of:</p>
  
  <pre><code>static MyClass *gInstance = NULL;
  
  + (MyClass *)instance
  {
      @synchronized(self)
      {
          if (gInstance == NULL)
              gInstance = [[self alloc] init];
      }
  
      return(gInstance);
  }
  </code></pre>
  
  <p>What could I be doing to improve this?</p>