NSOperation 全部运行
我的程序在程序员看不到的地方崩溃了。它可能与内存管理有关,但它肯定与多个线程和超过 200 个通知观察者有关...
我想知道这种启动派生 NSOperation 对象是否会确保所有操作都被执行作为一个线程上的正常执行?
[operation start];
[operation waitUntilFinished];
I have program that is crashing somewhere not really visible to programmer. It may have something to do with memory management but it definitively has something to do with multiple threads and more than 200 notification observers...
I would like to know if that kind of starting derived NSOperation object would ensure that all operations are being executed consequently as normal execution on one thread?
[operation start];
[operation waitUntilFinished];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您正在寻找的是
operationQueue.maxConcurrentOperationCount = 1
,然后将所有操作添加到NSOperationQueue
中。它们将被串行地、一个接一个地执行。I think what you're looking for is
operationQueue.maxConcurrentOperationCount = 1
and then add all your operations to theNSOperationQueue
. They will be executed serially, one after another.不,它启动操作,然后阻塞调用线程直到完成。
No, it starts the operation and then blocks the calling thread until it is done.