10
How to wait inside the NSThread until some event occur in iOS?
eg, We created a NSThread and started a thread loop. Inside the thread loop, there is condition to check whether the message queue has any messages. If there is a message, then it will call the corresponding method to do some operation, else it should wait until the message queue gets populated with a new message.
Is there any API or methods available to wait until some event occur?
For Example
NSThread *thread = [NSThread alloc]....@selector(threadLoop)
- (void)threadLoop
{
// Expecting some API or method that wait until some messages pushed into the message queue
if (...) {
}
}
Any help should be appreciated.