iphone - Grand Central Dispatch function call -
good day,
i have function encapsulated in gcd block, calls function encapsulated in gcd block.
problem is, need caller gcd block stop running, until function [self callfunction] ends.
i write function doesnt have gcd encapsulation, prefer not to. there solution?
thanks
since block can call method , store result. grab main queue if need update ui or whatever need after completion.
dispatch_queue_t queue = dispatch_queue_create("read disc", null); dispatch_async(queue, ^{ result = [self readdisc]; dispatch_async(dispatch_get_main_queue(), ^{ //update ui or whatever need result of readdisc }); }); dispatch_release(queue);
Comments
Post a Comment