zoukankan      html  css  js  c++  java
  • CFRunLoop学习

    from CFRunLoop Reference

    CFRunLoop monitors sources of input to a task and dispatches control when they become ready for processing.

    Examples of input source might include user input devices,network connection,periodic or timed-delay events,and asynchronous callbacks.

    Three types of objects can be monitored by a run loop:

    sources(CFRunLoopSource)

    timers(CFRunLoopTimer)

    observers(CFRunLoopObserver)

    Each sources,times or observers added to a run loop must be associated with one or more run loop modes.

    There is exactly one run loop per thread.

    RunLoop 是事件循环,用于schedule work 和协调输入事件.

    RunLoop 接受2种不同的事件源,input sources (异步事件)和 timer sources(同步事件)

    何时使用RunLoop?

    1.使用ports或自定义输入源 与其他线程通讯

    2.在线程中使用定时器

    3.在程序中使用performSelector等方法

    4.让线程周期性执行某个任务

  • 相关阅读:
    FFT学习笔记
    FWT(Fast Walsh Transformation)快速沃尔什变换学习笔记
    GMS2游戏开发学习历程
    [BZOJ3238][AHOI2013]差异 [后缀数组+单调栈]
    Trie树简单讲解
    自己的题
    小技巧
    编程注意事项
    构造方法
    递归
  • 原文地址:https://www.cnblogs.com/wustlj/p/2391582.html
Copyright © 2011-2022 走看看