[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSRunLoop and async. I/O
From: |
Andrew Ruder |
Subject: |
Re: NSRunLoop and async. I/O |
Date: |
Tue, 20 Sep 2005 19:17:46 -0500 |
User-agent: |
Mutt/1.5.6+20040907i |
On Mon, Sep 19, 2005 at 01:32:10PM -0400, Richard Stahl wrote:
> I have a server application that processes traffic from a large number
> of sockets asynchronously via Linux's epoll. Is there any way to
> combine my epoll event loop with an NSRunLoop without using additional
> threads? I guess a more general question: is there any way to add
> arbitrary event sources to a run loop?
Yes. netclasses does this with its asynchronous connections. Look at
these methods in GNUstep source:
-[NSRunLoop addEvent: type: watcher: forMode:]
-[NSRunLoop removeEvent: type: forMode: all:]
and implement the message:
- (void)receivedEvent: type: extra: forMode:
See
http://local.aeruder.net/svn/netclasses/trunk/Source/NetBase.m
for how netclasses uses this to add its connections.
Cheers,
Andy
Related link: http://netclasses.aeruder.net
--
Andrew Ruder
http://www.aeruder.net