- (void)saveWebDataInternal:(TaxiSpecialPlacesHierarchyResponseModel *)data completion:(void(^)(NSArray *))completion
{
NSBlockOperation *op = [[NSBlockOperation alloc] init];
op.completionBlock = ^{
dispatch_async(dispatch_get_main_queue(), ^{
[self loadCachedDataInternal:completion];
});
};
[op addExecutionBlock:^{
dispatch_semaphore_t mutex = dispatch_semaphore_create(0);
[self.relatedAddressesDAO asyncImportRelatedAddressHierarchy:data completion:^{
dispatch_semaphore_signal(mutex);
}];
dispatch_semaphore_wait(mutex, DISPATCH_TIME_FOREVER);
}];
// start operations
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[op start];
});
}
Last active
April 17, 2019 16:52
-
-
Save Mozilla9/16b0b5013256ff89e52b to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment