How about using NSOperationQueue
?
-(void) doSomeThing:(void (^)(BOOL success)) completionHandler
{
NSOperationQueue* callbackQueue = [NSOperationQueue currentQueue];
if(!callbackQueue) {
callbackQueue = [NSOperationQueue mainQueue];
}
dispatch_async(...,^{
// do heavyweight stuff here
// then call completionHandler
if(completionHandler) {
[callbackQueue addOperationWithBlock:^{
completionHandler(...);
}];
}
});