home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / s / s001 / 1.ddi / TS / SRC / CWSET.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-03-28  |  776 b   |  39 lines

  1. /*********
  2. *
  3. * 90-01-10 Hue
  4. *
  5. * Set channel pointer:
  6. *                   2   CW_ACK      q->top    := q->ahead
  7. *                   3   CW_NAK      q->ahead := q->top
  8. *
  9. **********/
  10.  
  11. #include <ts.h>
  12.  
  13. short cwset( CHAN *cn , short status)
  14. {
  15.     int  cpuflags;
  16.  
  17.     cpuflags = cli() ;                   /* disable interrupts */
  18.     if ( cn->wf && cn->wf != curproc ) {       /* reserved for someone else*/
  19.         putf( cpuflags ) ;
  20.         return 0 ;
  21.     }
  22.  
  23.     switch (status)
  24.     {
  25.       case CW_FLUSH : cn->q.bot = cn->q.top;
  26.               break;
  27.       case CW_ACK   : cn->q.top = cn->q.ahead;
  28.               break;
  29.       case CW_NAK   : cn->q.ahead = cn->q.top;
  30.               break;
  31.     }
  32.  
  33.     cn->q.empty = ( cn->q.top == cn->q.bot);
  34.     cn->q.full    = 0;
  35.  
  36.     putf(cpuflags);
  37.     return 1;
  38. }
  39.