On Thu, May 15, 2008 at 8:16 PM, ben syverson <[EMAIL PROTECTED]> wrote:

> I don't want to listen to any input, and I want the loop to execute as fast
> as possible. However, NSRunLoop says I need to set a timer or an input...

On Thu, May 15, 2008 at 8:53 PM, ben syverson <[EMAIL PROTECTED]> wrote:

> I have one thread which runs the server's infinite loop. It can't be the
> main thread, because it calls kevent, which doesn't return a value until
> there's an event. So that thread's loop stops while kevent is waiting.

The event you're using kqueue to block for is the input to which
NSRunLoop refers.

NSRunLoop is just Cocoa's implementation of a kevent()-style loop.
Instead of adding your socket to the kqueue, add it to the run loop
instead. (See e.g. http://cocoadevcentral.com/articles/000039.php --
which uses the CFRunLoop interface, but it's the same run loop.) No
need for a separate thread to handle the main task.

Hamish
_______________________________________________

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