On 17.05.2011, at 21:12, Wim Lewis wrote: > On 17 May 2011, at 9:54 AM, Bing Li wrote: >> But I noticed that Cocoa threading provides wait/pulse-like synchronization >> techniques, such as Condition. I believe these techniques can be used to >> control a thread which has a while-true loop. So I think RunLoop can be >> replaced. Do you think so? > > In a thread that you "own", you can certainly write in a style that does not > use a run loop, and this is sometimes the best approach. However, if you are > writing a GUI application, the main thread must be run loop based for the > application to work, because Cocoa relies on the run loop.
It's not just the main thread. Many asynchronous Cocoa APIs actually need a run loop to correctly function. You don't need a run loop to do some number crunching in basic C, but classes like NSURLConnection may not behave as expected if your thread has no run loop. Cheers, -- Uli Kusterer "The Witnesses of TeachText are everywhere..." http://www.lookandfeelcast.com _______________________________________________ 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