NSOperationqueue i want to block main thread

Posted by alexeyndru on Stack Overflow See other posts from Stack Overflow or by alexeyndru
Published on 2010-05-13T13:31:41Z Indexed on 2010/05/13 13:34 UTC
Read the original article Hit count: 238

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about iphone