title: How to confirm that a method will execute under main thread in objective C?
body: <p>I have a method say someMethod(), I always want this method should be executed under main thread. So I wrote this method like this..</p>
  
  <pre><code>-(void)someMethod
  {
     if([NSThread mainThread])
     {
         // Do method stuffs
     }
  
     else
     {
         [self performSelectorOnMainThread:@selector(someMethod) withObject:nil waitUntilDone:YES];
     }
  }
  </code></pre>
  
  <p><strong>Questions:</strong></p>
  
  <ul>
  <li>Is it the right approach?</li>
  <li>If, I call this method by background thread, what will happen?</li>
  </ul>
  
  <p>Thanks</p>