home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / next / programm / 5679 < prev    next >
Encoding:
Text File  |  1992-08-18  |  1.8 KB  |  42 lines

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