在创建线程中被经常遇见这些dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW,0), ^{ [selfabc];});- (void)abc {///获取当前时间longlastTime = getTickCount();while(YES) { usleep(30*1000);longt = getTickCount();NSLog(@"==== space = %ld", t - lastTime); lastTime = t; }}
关于这4个的优先级以此是:
1.DISPATCH_QUEUE_PRIORITY_HIGH
2.DISPATCH_QUEUE_PRIORITY_DEFAULT
3.DISPATCH_QUEUE_PRIORITY_LOW
4.DISPATCH_QUEUE_PRIORITY_BACKGROUND
另外在dispatch_async(dispatch_get_global_queue···函数中,因为本身是异步的,所以执行不一定谁先后。