Run Loop Sequence of Events21 Apr 2016
- Notify observers that the run loop has been entered.
- Notify observers that any ready timers are about to fire.
- Notify observers that any input sources that are not port based are about to fire.
- Fire any non-port-based input sources that are ready to fire.
- If a port-based input source is ready and waiting to fire, process the event immediately. Go to step 9.
- Notify observers that the thread is about to sleep.
- Put the thread to sleep until one of the following events occurs: An event arrives for a port-based input source. A timer fires. The timeout value set for the run loop expires. The run loop is explicitly woken up.
- Notify observers that the thread just woke up.
- Process the pending event. If a user-defined timer fired, process the timer event and restart the loop. Go to step 2. If an input source fired, deliver the event. If the run loop was explicitly woken up but has not yet timed out, restart the loop. Go to step 2.
- Notify observers that the run loop has exited.