iphone – 改变NSOperation优先级的安全方式

iphone – 改变NSOperation优先级的安全方式,第1张

概述有没有一种安全的方法来改变已经在NSOperationQueue中排队的NSOperation的优先级?如果 *** 作尚未启动,则没有问题,但如果它已经在执行,则会出现NSInvalidArgumentException. 一旦排队,你就不应该改变NSOperation.根据Apple的 Threading Programming Guide: Important: You should never m 有没有一种安全的方法来改变已经在NSOperationQueue中排队的NSOperation的优先级?如果 *** 作尚未启动,则没有问题,但如果它已经在执行,则会出现NSinvalidargumentexception.解决方法 一旦排队,你就不应该改变NSOperation.根据Apple的 Threading Programming Guide:

important: You should never modify an operation object after it has been added to a queue. While waiting in a queue,the operation Could execute at any time. Changing its status while it is executing Could have adverse effects. You can use the methods of the operation object to determine if the operation is running,waiting to run,or already finished.

总结

以上是内存溢出为你收集整理的iphone – 改变NSOperation优先级的安全方式全部内容,希望文章能够帮你解决iphone – 改变NSOperation优先级的安全方式所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1013541.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存