title: Running and managing NSTimer in different NSThread/NSRunLoop
body: <p>I'm writing a Cocoa application, with a GUI designed in Interface Builder. I need to schedule background activity (at regular intervals) without blocking the UI, so I run it in a separate thread, like this:</p>
  
  <pre><code>- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
      [self performSelectorInBackground:@selector(schedule) withObject:nil];
  }
  
  - (void) schedule {
      NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
      NSRunLoop* runLoop = [NSRunLoop currentRunLoop];
  
      timer = [[NSTimer scheduledTimerWithTimeInterval:FEED_UPDATE_INTERVAL
                                                    target:activityObj
                                          selector:@selector(run:)
                                          userInfo:nil
                                           repeats:YES]
           retain];
  
      [runLoop run];
      [pool release];
  }
  </code></pre>
  
  <p>I retain the timer, so I can easily invalidate and reschedule.</p>
  
  <p>Problem: I must also fire the run: method in response to GUI events, so it is synchronous (i.e. a "perform activity" button). Like this:</p>
  
  <pre><code>[timer fire];
  </code></pre>
  
  <p>I could do this with performSelectorInBackground too, and of course it doesn't block the UI. But this synchronous firings run in another runloop! So I have no guarantee that they won't overlap. How can I queue all of my firings on the same runloop?</p>