home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.next.programmer
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!destroyer!ncar!csn!boulder!alumni.cs.colorado.edu!rademach
- From: rademach@alumni.cs.colorado.edu (SIMON RADEMACHER)
- Subject: Re: select() broken?
- Message-ID: <1992Aug18.234207.4613@colorado.edu>
- Sender: news@colorado.edu (The Daily Planet)
- Nntp-Posting-Host: alumni.cs.colorado.edu
- Organization: University of Colorado, Boulder
- References: <1992Aug18.042006.12768@colorado.edu>
- Date: Tue, 18 Aug 1992 23:42:07 GMT
- Lines: 29
-
- In article <1992Aug18.042006.12768@colorado.edu> rademach@alumni.cs.colorado.edu (SIMON RADEMACHER) writes:
- [summary: select() did not see events on file descriptors after one
- disconnected.]
- >
- >5) When one of the accepted fd's disconnects, the read fd_set shows an
- > event on the fd. A read is done resulting in EOF. The fd is closed()
- > and removed from the read fd_set.
- OOPS----^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- I lied. The array used to mark active file descriptors was cleared of the
- disconnected fd. Hence, in the loop, the bit was not being set for that
- fd, but it remained set from the previous go through the loop. Actually
- clearing the bit fixes the problem.
-
- 6) From then on, the select() always waits for the duration of the time-
- > out, and returns 0, eg. no events in any of the sets.
-
- Hmm, that fixes the problem, but is this a bug? When the bit for
- a just close()d file is in the read fd_set, select() does not see any
- events on any file descriptors. I would guess that if any invalid fd were
- in the set the same thing would happen. So, whether select() is broken
- or not depends on if you think select() should be smart enough to ignore
- invalid/closed fds.
-
- In any case, thanks to those who sent mail with help.
-
- --
- Simon Rademacher
- rademach@alumni.cs.colorado.edu
-
-