{"id":1150,"url":"https://github.com/ibireme/YYDispatchQueuePool","last_synced_at":"2025-07-30T20:32:36.599Z","repository":{"id":56929975,"uuid":"45829920","full_name":"ibireme/YYDispatchQueuePool","owner":"ibireme","description":"iOS utility class to manage global dispatch queue.","archived":false,"fork":false,"pushed_at":"2017-12-15T03:00:36.000Z","size":556,"stargazers_count":476,"open_issues_count":12,"forks_count":96,"subscribers_count":22,"default_branch":"master","last_synced_at":"2024-11-30T11:48:14.384Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ibireme.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-09T10:03:14.000Z","updated_at":"2024-10-10T06:10:44.000Z","dependencies_parsed_at":"2022-08-21T00:01:12.246Z","dependency_job_id":null,"html_url":"https://github.com/ibireme/YYDispatchQueuePool","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibireme%2FYYDispatchQueuePool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibireme%2FYYDispatchQueuePool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibireme%2FYYDispatchQueuePool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibireme%2FYYDispatchQueuePool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ibireme","download_url":"https://codeload.github.com/ibireme/YYDispatchQueuePool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228187539,"owners_count":17882322,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:15:39.981Z","updated_at":"2024-12-04T20:31:01.869Z","avatar_url":"https://github.com/ibireme.png","language":"Objective-C","funding_links":[],"categories":["GCD","awesome-ios ##","WebSocket","iOS"],"sub_categories":["Getting Started","Other free courses","Linter","YYKit"],"readme":"YYDispatchQueuePool\n==============\n\n[![License MIT](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/ibireme/YYDispatchQueuePool/master/LICENSE)\u0026nbsp;\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\u0026nbsp;\n[![CocoaPods](http://img.shields.io/cocoapods/v/YYDispatchQueuePool.svg?style=flat)](http://cocoapods.org/pods/YYDispatchQueuePool)\u0026nbsp;\n[![CocoaPods](http://img.shields.io/cocoapods/p/YYDispatchQueuePool.svg?style=flat)](http://cocoadocs.org/docsets/YYDispatchQueuePool)\u0026nbsp;\n[![Support](https://img.shields.io/badge/support-iOS%206%2B%20-blue.svg?style=flat)](https://www.apple.com/nl/ios/)\u0026nbsp;\n[![Build Status](https://travis-ci.org/ibireme/YYDispatchQueuePool.svg?branch=master)](https://travis-ci.org/ibireme/YYDispatchQueuePool)\n\niOS utility class to manage global dispatch queue.\u003cbr/\u003e\n(It's a component of [YYKit](https://github.com/ibireme/YYKit))\n\nWhen use a concurrent queue to execute lots of blocks, I met this problem in some situation:\n\n\u003cimg src=\"https://raw.github.com/ibireme/YYDispatchQueuePool/master/Snapshots/CTRunDraw.png\" width=\"320\"\u003e\n\u003cimg src=\"https://raw.github.com/ibireme/YYDispatchQueuePool/master/Snapshots/CTRunDrawLock.png\" width=\"320\"\u003e\n\nWhen some block is locked, the concurrent queue may create lots of thread and may block the main thread.\nUse a global serial queue pool to avoid it.\n\nUsage\n==============\n```objc\n// Get a serial queue from global queue pool\ndispatch_queue_t queue = YYDispatchQueueGetForQOS(NSQualityOfServiceUtility);\n\n// Create a serial queue pool\nYYDispatchQueuePool *pool = [[YYDispatchQueuePool alloc] initWithName:@\"file.read\" queueCount:5 qos:NSQualityOfServiceBackground];\ndispatch_queue_t queue = [pool queue];\n```\n\nInstallation\n==============\n\n### CocoaPods\n\n1. Add `pod 'YYDispatchQueuePool'` to your Podfile.\n2. Run `pod install` or `pod update`.\n3. Import \\\u003cYYDispatchQueuePool/YYDispatchQueuePool.h\\\u003e.\n\n\n### Carthage\n\n1. Add `github \"ibireme/YYDispatchQueuePool\"` to your Cartfile.\n2. Run `carthage update --platform ios` and add the framework to your project.\n3. Import \\\u003cYYDispatchQueuePool/YYDispatchQueuePool.h\\\u003e.\n\n\n### Manually\n\n1. Download all the files in the YYDispatchQueuePool subdirectory.\n2. Add the source files to your Xcode project.\n3. Import `YYDispatchQueuePool.h`.\n\n\nDocumentation\n==============\nFull API documentation is available on [CocoaDocs](http://cocoadocs.org/docsets/YYDispatchQueuePool/).\u003cbr/\u003e\nYou can also install documentation locally using [appledoc](https://github.com/tomaz/appledoc).\n\n\nRequirements\n==============\nThis library requires `iOS 6.0+` and `Xcode 8.0+`.\n\n\nLicense\n==============\nYYDispatchQueuePool is provided under the MIT license. See LICENSE file for details.\n\n\n\n\u003cbr/\u003e\u003cbr/\u003e\n---\n中文介绍\n==============\niOS 全局并发队列管理工具。\u003cbr/\u003e\n(该项目是 [YYKit](https://github.com/ibireme/YYKit) 组件之一)\n\n当用 concurrent queue 来执行大量 block 时，有时会遇到下面这种情况：\n\n\u003cimg src=\"https://raw.github.com/ibireme/YYDispatchQueuePool/master/Snapshots/CTRunDraw.png\" width=\"320\"\u003e\n\u003cimg src=\"https://raw.github.com/ibireme/YYDispatchQueuePool/master/Snapshots/CTRunDrawLock.png\" width=\"320\"\u003e\n\n当某个 block 所在线程被锁住时，concurrent queue 会创建大量线程以至于占用了过多资源而影响到主线程。这里可以用一个全局的 serial queue pool 来尽量控制全局线程数。\n\n用法\n==============\n```objc\n// 从全局的 queue pool 中获取一个 queue\ndispatch_queue_t queue = YYDispatchQueueGetForQOS(NSQualityOfServiceUtility);\n\t\n// 创建一个新的 serial queue pool\nYYDispatchQueuePool *pool = [[YYDispatchQueuePool alloc] initWithName:@\"file.read\" queueCount:5 qos:NSQualityOfServiceBackground];\ndispatch_queue_t queue = [pool queue];\n```\n\t\n安装\n==============\n\n### CocoaPods\n\n1. 在 Podfile 中添加 `pod 'YYDispatchQueuePool'`。\n2. 执行 `pod install` 或 `pod update`。\n3. 导入 \\\u003cYYDispatchQueuePool/YYDispatchQueuePool.h\\\u003e。\n\n\n### Carthage\n\n1. 在 Cartfile 中添加 `github \"ibireme/YYDispatchQueuePool\"`。\n2. 执行 `carthage update --platform ios` 并将生成的 framework 添加到你的工程。\n3. 导入 \\\u003cYYDispatchQueuePool/YYDispatchQueuePool.h\\\u003e。\n\n\n### 手动安装\n\n1. 下载 YYDispatchQueuePool 文件夹内的所有内容。\n2. 将 YYDispatchQueuePool 内的源文件添加(拖放)到你的工程。\n3. 导入 `YYDispatchQueuePool.h`。\n\n\n文档\n==============\n你可以在 [CocoaDocs](http://cocoadocs.org/docsets/YYDispatchQueuePool/) 查看在线 API 文档，也可以用 [appledoc](https://github.com/tomaz/appledoc) 本地生成文档。\n\n\n系统要求\n==============\n该项目最低支持 `iOS 6.0` 和 `Xcode 8.0`。\n\n\n许可证\n==============\nYYDispatchQueuePool 使用 MIT 许可证，详情见 LICENSE 文件。\n\n\n相关文章\n==============\n[iOS 保持界面流畅的技巧\n](https://blog.ibireme.com/2015/11/12/smooth_user_interfaces_for_ios/) \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibireme%2FYYDispatchQueuePool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibireme%2FYYDispatchQueuePool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibireme%2FYYDispatchQueuePool/lists"}