dispatch_queue_create---创建队列
2016-05-20 17:41
423 查看
dispatch_queue_create(const char *label, dispatch_queue_attr_t attr);
可以看到创建队列的方法有两个参数可以传,默认的创建方式是这样的
dispatch_queue_t queue = dispatch_queue_create("TreeNewBee_queue", NULL);
后面的参数传入”NULL”就可以了。或许大家都是这样创建串行队列的。但请大家看看
dispatch_queue_create这个方法的具体描述
attr In OS X v10.7 and later or iOS 4.3 and later, specify DISPATCH_QUEUE_SERIAL (or NULL) to create a serial queue or specify DISPATCH_QUEUE_CONCURRENT to create a concurrent queue. In earlier versions, you must specify NULL for this parameter.
attr在OS X v10.7后来或iOS 4.3及以后,指定DISPATCH_QUEUE_SERIAL(或零)创建一个串行队列或指定DISPATCH_QUEUE_CONCURRENT创建创建并发队列。在早期版本中,您必须指定NULL为这个参数。
翻译已经很清楚了,第二个参数是可以传”NULL”或
DISPATCH_QUEUE_SERIAL
创建串行队列
也可以传入
DISPATCH_QUEUE_CONCURRENT创建并发队列
总结起来就是这样,除了全局并发队列
dispatch_queue_t queueglobal = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
还可以通过
// 创建串行队列 dispatch_queue_t queue = dispatch_queue_create("TreeNewBee_queue", DISPATCH_QUEUE_SERIAL); // 创建并发队列 dispatch_queue_t queueconcurrent = dispatch_queue_create("com.crediteae.TreeNewBee_queue", DISPATCH_QUEUE_CONCURRENT);
并不是之前说的那种
凡是自己创建的队列都是 串行队列
全局队列只有
dispatch_queue_t queueglobal = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
这样的说法了!
相关文章推荐
- Android UI高级之自定义控件
- UIAlertController的使用
- iOS UITableView拉伸图片,悬停控件和渐变导航栏效果
- 测试rest接口的两个工具使用详解(restclient+soapUI)
- Vue.js-----轻量高效的MVVM框架(六、Class与Style绑定)
- 设计模式 - Builder模式
- Query获取Select
- Java中 obj.toString()和String.valueof()
- Android UiAutomator UiSelector类
- 我的arduino theme文件
- FFmpeg Filtering Guide
- Tensorflow source build on MAC EI Capitain
- .NET UIAutomation实现Word文档加密暴力破解
- Parquet的timestamp类型转为long
- ugui制作弧形血条
- iOS开发 UITableView 常用细节
- UIScrollView的基本设置
- Vue.js-----轻量高效的MVVM框架(五、计算属性)
- Angular2 and Electron - The definitive guide
- ios学习--UIStepper