Re: Using NSThreads in command-line apps
Re: Using NSThreads in command-line apps
- Subject: Re: Using NSThreads in command-line apps
- From: ben syverson <email@hidden>
- Date: Thu, 15 May 2008 17:28:13 -0500
On May 15, 2008, at 4:17 PM, Jens Alfke wrote:
You can wire up kqueues to a runloop fairly easily. Instead of
blocking, the kqueue will post an event to the runloop when
something happens. Then instead of waiting in kevent, you just
handle events in your runloop, and your callback will be invoked as
necessary.
That's interesting... Although I think for now, having kevent in a
separate thread is working okay. When it gets a request, it locks a
shared NSMutableArray queue and sets an NSConditionLock indicating
that a worker thread should copy and clear the queue and then process
the requests... It seems to be working very well.
(My advice: unless you're seriously trying to write The Fastest Web
Server In The World, use NSStream and/or CFNetwork and follow their
asynchronous/runloop model.)
It's not that I'm trying to write The Fastest Web Server In The World,
it's just that I'm trying to squeeze every dollar out of my server
hardware. Besides, if I'm writing something from scratch, why not make
it scream? :)
- ben
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden