Wednesday, 21 August 2013

execute a (delayed-callback) block synchronously

execute a (delayed-callback) block synchronously

I'll make it simple, look at this code this is just an example:
double delayInSeconds = 2.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW,
(int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
// some op
});
is it possible to make the current thread pause until the block returns?

No comments:

Post a Comment