Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSOperationQueue 和 NSOperation 方式 #17

Open
Beyond-Chao opened this issue Mar 30, 2018 · 2 comments
Open

NSOperationQueue 和 NSOperation 方式 #17

Beyond-Chao opened this issue Mar 30, 2018 · 2 comments

Comments

@Beyond-Chao
Copy link

YY 大神你好,请教一个问题:

你用多个串行队列来实现并发、控制线程数量,避免GCD在并行队列上执行耗时任务时开辟过多线程、消耗系统资源。如果通过NSOperationQueue 和 NSOperation的方式,控制maxConcurrentOperationCount 为YYAsyncLayerGetDisplayQueue中的queueCount,能够实现同样的效果嘛?

@Tangdixi
Copy link

I prefer NSOperationQueue ~

@xll503721
Copy link

NSOperation的实现其实也是CGD了,所以一般情况下NS一层怎么都会有性能损失的,NSOperation感觉比较适合用在你要管理线程状态的时候,比如NSOperation的start,ready等的状态,可以看SW和YYImageWeb,大量用到NSOperation,主要原因是如果你要对并行并行队列做状态控制的话,比较麻烦,所以不得不用NSOperation,但假如你只想控制线程数量,何必直接用CGD串行队列呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants