As the title says the NSRunLoop's runMode:beforeDate: doesn't wait. What should I do to make the thread to wait with NSRunLoop.
I am running a method on background thread:
[self performSelectorInBackground:@selector(performOperation:) withObject:nil];
- (void)performSynchronousOperation:(operation *)operation
{
operationComplete = NO;
// Now wait for response
NSRunLoop *theRL = [NSRunLoop currentRunLoop];
while (!operationComplete && [theRL runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]);
return;
}
Background thread doesn't wait at while loop. Is there anything I am missing?