[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSRunLoop limitations
Re: NSRunLoop limitations
Wed, 23 Jan 2002 09:29:43 +0000
On Wednesday, January 23, 2002, at 02:06 AM, Kaelin Colclasure wrote:
I have run squarely into a limitation of the NSRunLoop
implementation. For the distributed benchmarking project I am working
on, I have found it necessary to increase the number of file
descriptors a single process can have open. Unfortunately, this has
illuminated the fact that the bowels of NSRunLoop are based on
select(2) rather than poll(2). This means that NSRunLoop suffers from
the FD_SETSIZE limitation that years ago convinced me to abandon
select in favor of poll and never look back. [Yes, I know about
-DFD_SETSIZE=nnn and I also know how non-portable it is and what a
PITA it is even when it works!]
There are (at least) two ways I can solve my problem:
1) I can replace NSRunLoop and the classes which intimately depend on
it within my programs.
2) I can rework GNUstep's NSRunLoop and intimates to use poll instead
Solution 1 has the virtue of being straightforward to code, but the
vice of being intimately coupled to other parts of the GNUstep code
base while being separately maintained. Solution 2 is probably more
work in the short term, but (assuming for the moment I got it right)
would solve this problem `once and for all'.
I'd like to hear from (at least) one of the GNUstep maintainers on
this point... Is this a limitation that bears removing? Or am I the
only developer who's ever (ab)used NSRunLoop in this particular
The use of select() is a historical limitation ... yes the base library
really *has* been around so long that when it was written a lot of
didn't have poll().
I've never found it to be a real difficulty - as the default set size
GNU/Linux is 1024 and I've never needed more than that many descriptors,
but I know it can be a problem occasionally and it would be nice to have
a poll() implementation.
We could use 'if HAVE_POLL' to control fallback to select() in case
are still select only operating systems in use.
The work of implementing a poll() solution is really almost trivial - it
would require a new implementation of a single method
or some conditional compilation within that method, but I think a
version of the whole method might be more readable.
I can't imagine how your solution 1 could be even close to being as
simple as solution 2, since what you are really talking about in 1 is
the entire class, but in 2 you would just rewrite one method.
- NSRunLoop limitations, Kaelin Colclasure, 2002/01/22
- Re: NSRunLoop limitations,
Richard Frith-Macdonald <=