On Sep 14, 2008, at 19:36 , John Michael Zorko wrote:


Julien et al,


sleep() is just blocking the thread, so no event is processed. Use run loops instead.

Try to replace sleep() with [[NSRunLoop currentRunLoop] runMode:beforeDate:]

You mean the NSURLConnection callbacks are not callbacks in the C / C ++ sense i.e. they're more like dispatched messages instead?

They are like C callbacks but they get called from the RunLoop. The connection gets add as a run loop source and when data is ready, the call-back will get invoked.

The other problem that you have with your current implementation is that your main thread will completely block too. If this is a console app, that's not really a problem, but if this is a GUI app, it will stop responding to events and give the user a beach-ball... they will probably think that something is wrong and may kill the application, so you should watch out for that.

J

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to