NSRunLoop

ghazban
Unregistered
 
Post: #1
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).
Quote this message in a reply
Feanor
Unregistered
 
Post: #2
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.
Quote this message in a reply
Post Reply