zoukankan      html  css  js  c++  java
  • Operation queues中多线程的支持

    Operation queues usually provide the threads used to run their operations. In OS X v10.6 and later, operation queues use the libdispatch library (also known as Grand Central Dispatch) to initiate the execution of their operations. As a result, operations are always executed on a separate thread, regardless of whether they are designated as concurrent or non-concurrent operations. In OS X v10.5, however, operations are executed on separate threads only if their isConcurrent method returns NO. If that method returns YES, the operation object is expected to create its own thread (or start some asynchronous operation); the queue does not provide a thread for it.

    OperationQueues通常提供了运行operationsd的线程。在OS X v10.6之后,operationsQueue使用libdispatch库(GCD)来初始化这些operations的执行逻辑。所以,operations通常是在一个独立的thread中执行,不管它是执行并发还是不支持并发。但是,在OS X v10.5系统中,operations只有在不支持并发的的情况下才使用同一个Thread执行任务,如果isConcurrent返回YES,那么operation object会被安排在各自不同的线程中去执行,operation queue不再提供执行的线程环境。

    作者:W.M.steve
    出处:http://www.cnblogs.com/weisteve/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    Linux的命令、用户、权限管理
    Java中快捷键
    数组的学习
    Java中方法定义和调用的学习
    java中的标识符、修饰符、关键字
    MYSQL的学习
    JavaScript小白教程2
    navicat中选择utf-8时的困惑
    python小白教程
    英语单词
  • 原文地址:https://www.cnblogs.com/weisteve/p/3053499.html
Copyright © 2011-2022 走看看