home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 5558 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: news.ifm.liu.se!marcus
  2. From: marcus@lysator.liu.se (Marcus Comstedt)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Waiting on >1 file
  5. Date: 16 Mar 1996 18:33:03 GMT
  6. Message-ID: <4if1gv$1ot@newsy.ifm.liu.se>
  7. References: <DoB07y.AsM.0.-s@cs.vu.nl>
  8. NNTP-Posting-Host: tina.lysator.liu.se
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=iso-8859-1
  11. Content-Transfer-Encoding: 8bit
  12. X-Newsreader: NN version 6.5.0 #24 (NOV)
  13.  
  14. irmen@cs.vu.nl (Irmen de Jong) writes:
  15.  
  16. >Say I have more than one file open. In my case all files are (virtual) console
  17. >files, like CON: or AUX:. What I want to do is to wait on ALL these
  18. >files simultaneously until one (or more) of them are ready to read, i.e.
  19. >have input available. dos.library/WaitForChar() only works for one file,
  20. >i need something like select() on sockets, but on files instead.
  21.  
  22. You'll have to create a MsgPort, and then post asynchronous ACTION_READ
  23. or ACTION_WAIT_CHAR packets with dos.library/SendPkt() to all the file
  24. handlers.  Then all you have to is exec.library/WaitPort() and check
  25. which packets are returned.  (Using packets is a little bit hairy, but
  26. this is the only way I know of...)
  27.  
  28. >Oh I tried the WaitSelect() from AmiTCP's bsdsocket.library but that
  29. >beast only works on real sockets, not on normal file descriptors. *sigh*
  30.  
  31. Using the packet method, you can pass the MsgPort's SigBit to WaitSelect()
  32. and wait on both files and sockets.  I do this in my port of TinyFugue.
  33.  
  34. --
  35. --------------------------------------------------------------------------
  36. Marcus Comstedt                          Lysator Academic Computer Society
  37. marcus@lysator.liu.se                    Linko"ping University, Sweden  //
  38. ----------------------------------------------------------------------\X/-
  39.