NSOperationqueue i want to block main thread
- by alexeyndru
i want to block the main thread until something else is done in the background.
i used:
result=[self performSelectorInBackground:@selector(calculate:) withObject:expression];
just bellow this line I am using result:
[self use:result];
i dont want to use result until it is available.
to achieve this I implemented
calculate:
{
[[(AppDelegate *)[[UIApplication sharedApplication] delegate] queue] waitUntilAllOperationsAreFinished];
calculating result...
}
and still, the result is used before it is calculated. so, i didnt block the main thread. pls help me do that.
thanks