On Mon, May 16, 2011 at 8:07 AM, Bing Li <lbl...@gmail.com> wrote: > Dear all, > > I am a new programmer of Cocoa. When learning RunLoop, I felt a little bit > weird. Why should Cocoa provide such a technique? When programming on other > environments, a while-true loop and wait/pulse lock can be used to achieve > the same goal of RunLoop, right?
Yes, but Cocoa is a framework, not a library. Older APIs (Win32 and classic Mac OS Carbon) required you to write your own busy loop and call into the library to get new events to process. Cocoa inverts this responsibility: your app lives within the framework, not vice versa. > I notice that Cocoa threading can be programmed in the similar way. May I > ignore RunLoop? No. Every thread has at most one runloop, and the main thread must be processing its runloop in order for your app to function. The framework requires it. --Kyle Sluder _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com