网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

浅谈NSOperation的并发与非并发-创新互联

Operation分为并发和非并发两种,也即相对caller线程是同步的还是异步的。对于提交到Operation queue中的operation来说,都是异步的,但是如果手动启动operation的话,就有异步和非异步的区分了。

成都创新互联公司-专业网站定制、快速模板网站建设、高性价比兴化网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式兴化网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖兴化地区。费用合理售后完善,十年实体公司更值得信赖。

Although you typically execute operations by adding them to an operation queue, doing so is not required. It is also possible to execute an operation object manually by calling its start method, but doing so does not guarantee that the operation runs concurrency with the rest of your code. The isConcurrent method of the NSOperation class tells you whether an operation runs synchronously or asynchrously with respect to the thread in which its start method was called. By default, this method returns NO, which means the operation runs synchronously in the calling thread.

If you want to implement a concurrent operation - that is, one that runs asynchronously with respect to the calling thread - you must write additional code to start the operation asynchronously. For example, you might spawn a separate thread, call an asynchronous system function, or do anything else to ensure that the start method starts the task and returns immediately and, in all likeihood, before the task is finished.

Most developers should never need to implement concurrent operation objects. If you always ad your operations to an operation queue, you do not need to implement concurrent operations. When you submit a nonconcurrent operation to an operation queue, the queue itself creates a thread on which to run your operation. Thus, adding a nonconcurrent operation to an operation queue still results in the asynchronous execution of your operation object code. The ability to define concurrent operations is only necessary in cases where you need to execute the operation asynchronously without adding it to an operation queue.

For information about how to create a concurrent operation, see "Configuring Operations for Concurrent Execution" and NSOperation Class Reference.

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


新闻标题:浅谈NSOperation的并发与非并发-创新互联
本文网址:http://bjjierui.cn/article/peogh.html

其他资讯