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.让线程周期性执行某个任务

  • 相关阅读:
    C#-------------枚举
    C#-------------类型构造器
    C#-内存天下
    线程在C#中的使用
    C#遗忘笔记--品味类型
    二分查找算法(C#实现)
    Linq 表达式树
    javascript中的对象
    this绑定的顺序
    弹出对话框
  • 原文地址:https://www.cnblogs.com/wustlj/p/2391582.html
Copyright © 2011-2022 走看看