ibireme/YYDispatchQueuePool
Tentang
iOS utility class to manage global dispatch queue.
Pengembangan web dan aplikasiPertumbuhan bintang terukur
- dalam 24 jam
- 0
- dalam 7 hari
- 0
- dalam 15 hari
- 0
- dalam 1 bulan
- Mengumpulkan riwayat
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
AsliYYDispatchQueuePool
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.
Usage
// 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];
Installation
CocoaPods
- Add
pod 'YYDispatchQueuePool'to your Podfile. - Run
pod installorpod update. - Import <YYDispatchQueuePool/YYDispatchQueuePool.h>.
Carthage
- Add
github "ibireme/YYDispatchQueuePool"to your Cartfile. - Run
carthage update --platform iosand add the framework to your project. - Import <YYDispatchQueuePool/YYDispatchQueuePool.h>.
Manually
- Download all the files in the YYDispatchQueuePool subdirectory.
- Add the source files to your Xcode project.
- Import
YYDispatchQueuePool.h.
Documentation
Full API documentation is available on CocoaDocs.
You can also install documentation locally using appledoc.
Requirements
This library requires iOS 6.0+ and Xcode 8.0+.
License
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];
安装
CocoaPods
- 在 Podfile 中添加
pod 'YYDispatchQueuePool'。 - 执行
pod install或pod update。 - 导入 <YYDispatchQueuePool/YYDispatchQueuePool.h>。
Carthage
- 在 Cartfile 中添加
github "ibireme/YYDispatchQueuePool"。 - 执行
carthage update --platform ios并将生成的 framework 添加到你的工程。 - 导入 <YYDispatchQueuePool/YYDispatchQueuePool.h>。
手动安装
- 下载 YYDispatchQueuePool 文件夹内的所有内容。
- 将 YYDispatchQueuePool 内的源文件添加(拖放)到你的工程。
- 导入
YYDispatchQueuePool.h。
文档
你可以在 CocoaDocs 查看在线 API 文档,也可以用 appledoc 本地生成文档。
系统要求
该项目最低支持 iOS 6.0 和 Xcode 8.0。
许可证
YYDispatchQueuePool 使用 MIT 许可证,详情见 LICENSE 文件。
相关文章
Jelajahi proyek terkait
Memuat…