home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff294.lzh / DNet / amiga / lib / waitqueue.c < prev   
C/C++ Source or Header  |  1989-12-11  |  669b  |  36 lines

  1.  
  2. /*
  3.  *  WaitQueue.C
  4.  */
  5.  
  6. #include "lib.h"
  7.  
  8. short
  9. WaitQueue(_chan, skipior)
  10. void *_chan;
  11. IOSTD *skipior;
  12. {
  13.     CHANN *chan = (CHANN *)_chan;
  14.     IOSTD *io;
  15.  
  16.     short error = 0;
  17.     while (chan->queued > chan->qlen) {     /*  until done  */
  18.     WaitPort(&chan->port);                     /*  something   */
  19.     io = (IOSTD *)GetMsg(&chan->port);
  20.     if (io->io_Message.mn_Node.ln_Type == NT_REPLYMSG) {
  21.         if (error == 0)
  22.         error = io->io_Error;
  23.         if (io != skipior) {
  24.         if (io->io_Length)
  25.             FreeMem(io->io_Data, io->io_Length);
  26.         FreeMem(io, sizeof(IOSTD));
  27.         }
  28.         --chan->queued;
  29.     } else {
  30.         AddTail(&chan->rdylist, (NODE *)io);
  31.     }
  32.     }
  33.     return(error);
  34. }
  35.  
  36.