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

  • 相关阅读:
    Grakn Forces 2020 I. Bitwise Magic
    October Challenge 2020 Division 1
    杂题
    杂题
    杂题
    hdu 6868
    Codeforces Round #673 (Div. 1)
    杂题
    2019 ICPC World Finals K
    【CSP2019】括号树 题解(递推+链表)
  • 原文地址:https://www.cnblogs.com/wustlj/p/2391582.html
Copyright © 2011-2022 走看看