I have a singleton class to download some data from the web. I am calling the download method of the singleton class from other class ‘A’ inside a GCD Queue and the downloads starts. The same time I am also executing this download method from a class ‘B’ in a GCD Queue. In this situation I want to inform the Class ‘B’ to wait until the download is completed. And when the download is completed give a copy of the downloaded data to class ‘B’ also. Here I am trying to download the same file from two classes A and B, otherwise there is no problem in my implementation. How is it possible?
Means here I am calling the same method in different threads. So how can I signal the thread B that the same file download is in progress in thread A and when finished pass the data to thread B also
- (NSData *)Download:(NSString *)urlString{
// here I am doing all the downloading operations
return data;
}
Downloader.h
Downloader.m
Hope this is clear enough