apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Reid" <dr...@jetnet.co.uk>
Subject Poll Patch
Date Wed, 21 Mar 2001 16:39:31 GMT
Attached is a patch for the unix/beos poll implementations using select.
Basically they don't work as we'd expect them to.  I found the problem
during a coding session last night to get the beos MPM stopping/restarting.

The problem is that when we create and setup the pollset we add the fd's to
the fd_set and then pass the fd_set into select, where it gets altered, and
hence looses some of the information.  Imagine the following

fd_set has fd 0 and fd 1
select waits for data on fd 0 and fd 1
select finds data on fd 1
fd_set now has fd 1
select waits for data on fd 1
<oops> !

:(  Not good.  This basically means that the select based impl. doesn't have
the same behaviour as the poll one and that's something we need to fix.

The patch basically adds a second set of fd_set's to the pollset and when
you add/remove fd's from the pollset, you affect the new fd_sets.  Just
before we actually go into select, we copy the new fd_set's into the fd_set
we pass to select, and store the results as before.  I've tested it on BeOS
and if no-one objects I'll commit on Thursday afternoon (GMT).  This will
impose a bit of a performance penalty, and there may be a better solution,
but this works and is simple enough that it illustrates the problem nicely.


View raw message