CFRunLoop and NSRunLoop are objects which represent the infinite loop associated with each thread for listening to input sources, timers, etc. and execute them when the event arrives. It is also known as event loops outside Apple.
Run loop modes
Every thread has exactly one run loop, but each run loop has multiple modes. Every input source can be added to one or more modes, and when that mode is run, only those sources will be listened.
The following are some run loop modes:
|Mode||Purpose||Part of common modes?|
|kCFRunLoopDefaultMode||The default run loop mode, almost encompasses every sources. You should always add sources and timers to this mode if there's no special reasons. Can be accessed with the symbol kCFRunLoopDefaultMode and NSDefaultRunLoopMode.||Yes|
|NSTaskDeathCheckMode||Used by NSTask to check if the task is still running.||Yes|
|Various private run loop modes used by CFNetwork for blocking operations||No|
|GSEventReceiveRunLoopMode||Receiving system events.||No|
|com.apple.securityd.runloop||Communication with securityd. Used by SpringBoard only.||No|
- Official reference: http://developer.apple.com/iphone/library/documentation/CoreFoundation/Reference/CFRunLoopRef/Reference/reference.html