1

How does NSURLConnection asynchronous request gives its callbacks on the same thread it was called from?

If I have to design a worker class that would take some work off the calling thread and when it is done it would give the completion callback on the same thread that it was called from, How would I do that?

typedef void (^BasicTask)(void);

@protocol WorkerDelegate
- (void)taskDidSucceed;
- (void)taskDidFailWithError:(NSString *)errorDescription;
@end

@interface Worker {
    id <WorkerDelegate> delegate;
}
-(void)performTaskInBackground:(BasicTask)task;
@end
defactodeity
  • 714
  • 1
  • 8
  • 21
  • Closely related, maybe a duplicate: [Dispatch async and calling a completion handler on the original queue](http://stackoverflow.com/q/13098030) – jscs May 15 '13 at 03:03

0 Answers0