title: How to multithred correctly? UIAlertView is not displayed, only gray screen
body: <p>i have implemented textToSpeech in my project and want to display an alertview while text is spoken. here i am calling the methods for textToSpeech:  </p>
  
  <pre><code>//-----before TTS starts i try to display alertView with Cancelbutton  
  //[self performSelectorOnMainThread:@selector(alertWhileTTS) withObject:nil waitUntilDone:YES]; //gray view and no alertview
  //[self performSelector:@selector(alertWhileTTS)];  //gray view and no alertview
  //[self alertWhileTTS];  //gray view and no alertview
  
  //this part here is blocking, no gray screen, 
  //after TTS is ready, the alertView is displayed
  dispatch_async(dispatch_get_main_queue(), ^{
          //Update UI if you have to
          [self alertWhileTTS];
      });
  
  
  [[self view] setNeedsDisplay];
  [self synthesizeInBackground];
  [queue waitUntilAllOperationsAreFinished];
  [self setIsSpeaking: false];
  [[self view] setNeedsDisplay];  
  </code></pre>
  
  <p>Here the synthesizeInBackground method(<em>in method</em> <code>synthesize</code> <em>starts the TTS</em>):  </p>
  
  <pre><code>- (void) synthesizeInBackground {
      queue = [[NSOperationQueue alloc] init];
      operation = [[NSInvocationOperation alloc] initWithTarget:self 
      selector:@selector(synthesize) object:nil];
  
      [queue addOperation: operation];
  }  
  </code></pre>
  
  <p>While TTS i want to display an alertView with <code>cancel</code> button. But in my case i am only getting a gray screen without the alertView.  </p>
  
  <p><strong>How can i call alertWhileTTS correctly</strong>, so the alertView gets displayed?  </p>
  
  <p>here is the content of alertWhileTTS:  </p>
  
  <pre><code>- (void) alertWhileTTS {
  UIAlertView *inboxRead = [[[UIAlertView alloc] initWithTitle:@"Inbox tts..."
                                                      message:nil
                                                     delegate:self
                                            cancelButtonTitle:@"Abbrechen"
                                            otherButtonTitles:nil] autorelease];
  inboxRead.tag = 997;
  
  [inboxRead show];
  }  
  </code></pre>
  
  <p><strong>UPDATE</strong> see my solution, that works:  </p>
  
  <pre><code>[self performSelectorOnMainThread:@selector(alertWhileTTS) withObject:nil waitUntilDone:YES];
  
      dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, (unsigned long)NULL), ^(void) {
          [[self view] setNeedsDisplay];
          [self synthesizeInBackground];
          [queue waitUntilAllOperationsAreFinished];
          [self setIsSpeaking: false];
          [[self view] setNeedsDisplay];
  
      }); 
  </code></pre>