Dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0 ), ^{
nsstring *urlstring = @ "http://img0.pconline.com.cn/pconline/1111/28/2601303_p2.jpg" ;
nsurl *url = [nsurl urlwithstring: urlstring];
nsdata *sdata = [nsdata datawithcontentsofurl: url];
if (SData && SData. length > 0)
{
dispatch_async(dispatch_get_main_queue(), ^ (void) {
NSLog(@ ">>>>>>>>>>main queue");
});
}
});
1. GCD's dispatch queue
Http://www.cnblogs.com/scorpiozj/archive/2011/07/25/2116459.html
2. The magic of GCD in iOS
http://blog.csdn.net/favormm/article/details/6453260
3. Officially, it's a lot of content.
http://developer.apple.com/library/ios/#documentation/performance/reference/gcd_libdispatch_ref/reference/reference.html
http://developer.apple.com/library/ios/#documentation/general/conceptual/concurrencyprogrammingguide/ Operationqueues/operationqueues.html#//apple_ref/doc/uid/tp40008091-ch102-sw1
4. Detailed iOS Development application concurrency dispatch Queues
Http://mobile.51cto.com/iphone-283323.htm
5. Stanford University's lecture notes on GCD
Http://www.stanford.edu/class/cs193p/cgi-bin/drupal/system/files/lectures/Lecture 13_0.pdf
GCD is actually a simple version of multithreading. GCD and block are brothers, so learn gcd before need to understand block, do not know also nothing, look at the code to understand.