ibireme / yydispatchqueuepool Goto Github PK
View Code? Open in Web Editor NEWiOS utility class to manage global dispatch queue.
License: MIT License
iOS utility class to manage global dispatch queue.
License: MIT License
你好,请问
dispatch_async(self.mainQueue, ^{
dispatch_sync(self.subQueue, ^{
NSLog(@"%@", [NSThread currentThread]);
这种,chatMainQueue使用YYDispatchQueuePool的queue,或者使用一个SERIAL的queue,是有创建新的NSThread,这种好像系统控制了资源分配,可是当处理比较长,创建的NSThread越多,内存问题就越大。不知是否有可行办法。
实现非主线程的串行队列,也是想控制其在一个或者固定几个NSThread执行,然后再回到主线程更新UI。
没有明显感觉到系统开启多个GCD线程导致卡顿
不好意思,请原谅我的粗浅,从源码里看,这queue是一个serial队列,这样不就让这个队列失去了并发的功能了么?不是非常明白这个库的目的是在解决什么问题?
NS_ENUM_AVAILABLE(10_10, 8_0)
项目是Objective-C++,有很多.mm文件。手动引入后报这个错误,手动把.h.m拖到工程里面的。
Undefined symbols for architecture arm64:
"YYDispatchQueueGetForQOS(NSQualityOfService)", referenced from:
-[CameraManager queue] in CameraManager.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
能够描述一下,你说的那种在并发队列下,某一个Block导致子线程发生死锁后,系统会无限制创建子线程的情况吗?
我好想没有试出来...
大神求指教~~~
如题,如果真需要实现这么一套,那么最大的线程并发数请教下是如何测试的?
如题,系统输入法打fo, 点击for 会变成 fo r
搜狗输入法 点击联想词汇插入到后面。变成了fofor
UITextView不会有问题。对应英文输入的用户有很大困扰,希望能够修复
我看了下NSQualityOfServic
这个枚举,在iOS8及以上的版本才能用啊
typedef NS_ENUM(NSInteger, NSQualityOfService) {
/* UserInteractive QoS is used for work directly involved in providing an interactive UI such as processing events or drawing to the screen. */
NSQualityOfServiceUserInteractive = 0x21,
/* UserInitiated QoS is used for performing work that has been explicitly requested by the user and for which results must be immediately presented in order to allow for further user interaction. For example, loading an email after a user has selected it in a message list. */
NSQualityOfServiceUserInitiated = 0x19,
/* Utility QoS is used for performing work which the user is unlikely to be immediately waiting for the results. This work may have been requested by the user or initiated automatically, does not prevent the user from further interaction, often operates at user-visible timescales and may have its progress indicated to the user by a non-modal progress indicator. This work will run in an energy-efficient manner, in deference to higher QoS work when resources are constrained. For example, periodic content updates or bulk file operations such as media import. */
NSQualityOfServiceUtility = 0x11,
/* Background QoS is used for work that is not user initiated or visible. In general, a user is unaware that this work is even happening and it will run in the most efficient manner while giving the most deference to higher QoS work. For example, pre-fetching content, search indexing, backups, and syncing of data with external systems. */
NSQualityOfServiceBackground = 0x09,
/* Default QoS indicates the absence of QoS information. Whenever possible QoS information will be inferred from other sources. If such inference is not possible, a QoS between UserInitiated and Utility will be used. */
NSQualityOfServiceDefault = -1
} NS_ENUM_AVAILABLE(10_10, 8_0);
#define MAX_QUEUE_COUNT 32
int count = (int)[NSProcessInfo processInfo].activeProcessorCount;
count = count < 1 ? 1 : count > MAX_QUEUE_COUNT ? MAX_QUEUE_COUNT : count;
iPhone在代码上获取处理器个数count为2,而且这个count应该不会超过32吧?
const char *name = dispatch_queue_get_label(queue);
if (name) strlen(name);
为了问题简单化,我的qos都是最高的 4核,如果我有40个任务放到queue中,这样4个queue都是10个任务串行,其中一个queue的线程死锁了,是不是死锁的这个线程不能执行后面的任务,如果是这样的话,是不是设计部缺陷,,
虽然看了RADME, 读了代码,but依旧无法理解在什么场景中,需要用YYDispatchQueuePool来替换NSOperationQueue。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.