rag*_*hul 3 objective-c grand-central-dispatch ios
我需要创建一个异步执行的队列,但是任务执行的顺序必须是串行的
dispatch_queue_t queue;
queue = dispatch_queue_create("com.test.app", NULL); //create a serial queue can either be null or DISPATCH_QUEUE_SERIAL
dispatch_async(queue,
^{
//Mycode for doing background http
}
Run Code Online (Sandbox Code Playgroud)
我认为你做得对,
dispatch_queue_t queue;
queue = dispatch_queue_create("com.test.app", NULL); //create a serial queue can either be null or DISPATCH_QUEUE_SERIAL
dispatch_async(queue,
^{
task1;
task2;
...
all this tasks wil be done done sequentially
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2378 次 |
| 最近记录: |