TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Feb 2016 |
Maintained by ibireme.
iOS utility class to manage global dispatch queue.
(It's a component of YYKit)
When use a concurrent queue to execute lots of blocks, I met this problem in some situation:
When some block is locked, the concurrent queue may create lots of thread and may block the main thread. Use a global serial queue pool to avoid it.
// Get a serial queue from global queue pool
dispatch_queue_t queue = YYDispatchQueueGetForQOS(NSQualityOfServiceUtility);
// Create a serial queue pool
YYDispatchQueuePool *pool = [[YYDispatchQueuePool alloc] initWithName:@"file.read" queueCount:5 qos:NSQualityOfServiceBackground];
dispatch_queue_t queue = [pool queue];
YYDispatchQueuePool.h
.Full API documentation is available on CocoaDocs.
You can also install documentation locally using appledoc.
This library requires iOS 6.0+
and Xcode 7.0+
.
YYDispatchQueuePool is provided under the MIT license. See LICENSE file for details.
iOS 全局并发队列管理工具。
(该项目是 YYKit 组件之一)
当用 concurrent queue 来执行大量 block 时,有时会遇到下面这种情况:
当某个 block 所在线程被锁住时,concurrent queue 会创建大量线程以至于占用了过多资源而影响到主线程。这里可以用一个全局的 serial queue pool 来尽量控制全局线程数。
// 从全局的 queue pool 中获取一个 queue
dispatch_queue_t queue = YYDispatchQueueGetForQOS(NSQualityOfServiceUtility);
// 创建一个新的 serial queue pool
YYDispatchQueuePool *pool = [[YYDispatchQueuePool alloc] initWithName:@"file.read" queueCount:5 qos:NSQualityOfServiceBackground];
dispatch_queue_t queue = [pool queue];
YYDispatchQueuePool.h
。你可以在 CocoaDocs 查看在线 API 文档,也可以用 appledoc 本地生成文档。
该项目最低支持 iOS 6.0
和 Xcode 7.0
。
YYDispatchQueuePool 使用 MIT 许可证,详情见 LICENSE 文件。