NSRunLoop - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: NSRunLoop (/thread-7262.html)
NSRunLoop - ghazban - Mar 3, 2003 01:02 PM
I am relatively new to cocoa programming.
What exactly is a NSRunLoop?
All I know is that timers are added to it, and executed by it, but my knowledge ends there, and I have a hard time understanding apple's documentation on it...
It would be great if somebody could give me a link or explain it (what to use it for, how to use it efficient).
NSRunLoop - Feanor - Mar 3, 2003 01:23 PM
While I think I know what NSRunLoop does, my knowledge is sparse, so you might check out this entry on CocoaDev.
There are a couple of other indie Cocoa documentation sites, including Cocoa Dev Central.
The run loop is like an event loop, but more comprehensive. In addition to event handling, it schedules timers and notifications, as you mentioned. Mostly it runs in the background, working for you, without you having to ever talk to it directly. Essentially it is just a loop of tasks which have to be repeated in a cycle to make an event driven, message-based application work well. Every thread of an AppKit application has an associated runloop instance which is created by the NSApplication instance, NSApp.