title: Detach a recursive method in a separate thread - Objective-C
body: <p>Got a bit of a problem over here... I'm in the middle of writing an ios application (a game), and I need it to be able to pause itself. So I thought the best way to do that is to detach the game execution in a separate thread so that the main thread can simply stop it on demand. The only problem is: when you run the game, a recursive function is called (recursion accomplished by:)</p>
  
  <pre><code>[self performSelector: withObject: afterDelay:]
  </code></pre>
  
  <p>and I have no idea how to isolate a recursive method into a new thread. I've tried:</p>
  
  <pre><code>[NSThread detachNewThreadSelector:@selector(myThreadMainMethod:) toTarget:self withObject:nil];
  </code></pre>
  
  <p>but it executes without recursion (just the one time)... And I figure, if I detach a new thread again at the end of my method, I'd just get stuck with a bunch of separate threads.</p>