When the run loop is about to process a timer. 【runloop即将处理处罚timer】
When the run loop is about to process an input source. 【runloop即将处理处罚input source】
When the run loop is about to go to sleep. 【runloop即将休眠】
When the run loop has woken up, but before it has processed the event that woke it up. 【runloop被叫醒时, 但是在runloop处理处罚叫醒它的变乱之前】
The exit from the run loop. 【退出runloop】
你可以通过 Core Foundation 添加 runloop Observers,可以根据自己感爱好的变乱,设置自界说回调 和 运动
创建一个runloop Observer时,你可以指定 是一次性 还是 重复的(once or repeatedly)
- once observer在触发后,将自身从runloop中移除- repeatedly observer在触发后,仍旧附加在runloop中6)runloop变乱序列
变乱序列:
Notify observers that the run loop has been entered.
关照observer 已经进入runloop
Notify observers that any ready timers are about to fire.
关照observer 即将处理处罚timer
Notify observers that any input sources that are not port based are about to fire.
关照observer 即将处理处罚非基于port的 input source
Fire any non-port-based input sources that are ready to fire.
关照observer 处理处罚 非基于port的 input source
If a port-based input source is ready and waiting to fire, process the event immediately. Go to step 9.
如果基于port的 input source 已ready,等待触发,则立即处理处罚变乱。实验步调9
Notify observers that the thread is about to sleep.
关照observer 线程即将休眠
Put the thread to sleep until one of the following events occurs:
线程休眠 直到以下几个变乱之一发生
An event arrives for a port-based input source.
基于port的 input source变乱到来
A timer fires.
timer 触发
The timeout value set for the run loop expires.
runloop 设置的超时 逾期
The run loop is explicitly woken up.
runloop 被显式叫醒
Notify observers that the thread just woke up.
关照observer 线程被叫醒
Process the pending event.
处理处罚挂起的变乱
If a user-defined timer fired, process the timer event and restart the loop. Go to step 2.
如果用户界说的timer触发,处理处罚timer变乱,并重启runloop 跳转2
If an input source fired, deliver the event.
如果input source触发,交付变乱
If the run loop was explicitly woken up but has not yet timed out, restart the loop. Go to step 2.
如果runloop被显式叫醒,但还没有超时,则重启runloop 跳转2