I take a look to the GCD, and coming from c++, it comes natural to write code in this way:
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
while(YES) {
if(<condition>) {
/* here I need to call a delegate */
}
sleep(1);
}
});
Is this the right way to do a loop in a objective-c thread?
Trying to understand, I was looking inside Reachability framework that I suppose launch a background thread to continuously check connection status, but I can't understand how do the "loop".
0 comments:
Post a Comment