Skip navigation.
 
mlRe: Using NSThreads in command-line apps
FROM : ben syverson
DATE : Fri May 16 00:28:13 2008

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

Related mailsAuthorDate
mlUsing NSThreads in command-line apps ben syverson May 15, 20:42
mlRe: Using NSThreads in command-line apps Bill Bumgarner May 15, 20:47
mlRe: Using NSThreads in command-line apps Randall Meadows May 15, 20:49
mlRe: Using NSThreads in command-line apps Uli Kusterer May 15, 20:51
mlRe: Using NSThreads in command-line apps Jens Alfke May 15, 20:52
mlRe: Using NSThreads in command-line apps ben syverson May 15, 21:16
mlRe: Using NSThreads in command-line apps ben syverson May 15, 21:17
mlRe: Using NSThreads in command-line apps Bill Bumgarner May 15, 21:25
mlRe: Using NSThreads in command-line apps Bill Bumgarner May 15, 21:31
mlRe: Using NSThreads in command-line apps ben syverson May 15, 21:53
mlRe: Using NSThreads in command-line apps Jens Alfke May 15, 23:17
mlRe: Using NSThreads in command-line apps ben syverson May 16, 00:28
mlRe: Using NSThreads in command-line apps Sherm Pendley May 16, 00:31
mlRe: Using NSThreads in command-line apps Hamish Allan May 16, 00:33
mlRe: Using NSThreads in command-line apps ben syverson May 16, 00:40
mlRe: Using NSThreads in command-line apps Hamish Allan May 16, 01:06
mlRe: Using NSThreads in command-line apps Jens Alfke May 16, 03:02
mlRe: Using NSThreads in command-line apps ben syverson May 16, 06:50