iphone Programming Glossary: self.lock
NSURLConnection blocking wrapper implemented with semaphores [closed] http://stackoverflow.com/questions/13733124/nsurlconnection-blocking-wrapper-implemented-with-semaphores @implementation BlockingConnection id initWithURL NSURL url callback void ^ NSData data callback if self super init self.lock ProducerConsumerLock new dispatch_async dispatch_get_global_queue DISPATCH_QUEUE_PRIORITY_DEFAULT 0 ^ NSURLRequest request.. timeoutInterval 10 NSURLConnection connectionWithRequest request delegate self while self.lock.finished NSRunLoop currentRunLoop runMode NSDefaultRunLoopMode beforeDate NSDate distantFuture self.lock consume ^ NSData.. self while self.lock.finished NSRunLoop currentRunLoop runMode NSDefaultRunLoopMode beforeDate NSDate distantFuture self.lock consume ^ NSData data if callback nil callback data return self void connectionWithURL NSURL url callback void ^ NSData..
|