Re: Question <01bcdeae$f8d42620$12a2d5d0@awe.chaos-anarchy.com>

From: Jeremy Elson (jelson@CIRCLEMUD.ORG)
Date: 10/22/97


As far as I know, the semantics of select() are the same under both
UNIX and Windows.  The fd_count argument itself (select's first
argument) is not changed; it can't be, because an int (not a pointer
to an int) is passed.  select()'s other four arguments are changed
after the call, though.  The second, third, and fourth arguments are
fd_set structures containing the list of FD's that should be checked
for readability, writability, and exceptional conditions; when select()
returns, those sets are replaced with sets containing a list of the
FD's that are actually ready to be read/written/excepted.  The
'timeout' arg is replaced, I think, with the time remaining on the
timer (i.e. the original value of timeout minus the actual time that
passed in select()).

In any case, yes, the fd_set args are destroyed each time select() is
called, but that doesn't matter because the sets are recalculated
before each call anyway.  Circle recalculates them instead of making a
copy because the contents of the set can change from call to call,
depending on who has connected or disconnected since the last call.

-j


Franco Gasperino writes:
>  Just the other day I was taking a look at comm.c, and noticed
>that calls to select() seemed a bit odd. Now, i've used select()
>under windows, and have noticed that the integer that stores
>the fd_count is reset to 0 after each select call. I've always had
>to make a temporary fd_set object to hold this temp value, then
>replace it after a select call.
>  Circle does not seem to do this. As a matter of fact, while I
>haven't step through it to see what it actually does under Linux,
>I don't even see a temp data item to hold a value like that.
>Could someone clue me in if that fd_count problem is specific
>to windows, or did I overlook something. All of my books
>describing the ip functions under unix also show the coping of
>the fd_set too.
>
>Franco Gasperino
>Cutting Edge Communications
>Programmer / System Administrator
>http://www.cet.com/
>509-444-INET
>awe@cet.com
>
>
>     +------------------------------------------------------------+
>     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
>     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
>     +------------------------------------------------------------+


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST