home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / s / s001 / 1.ddi / TS / SRC / CREL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-01-27  |  1.0 KB  |  40 lines

  1.                 /******************************************
  2.            *            CREL.C             *
  3.                * Copyright TimeSlice, Inc. 1985, 86, 87. *
  4.                ******************************************/
  5.  
  6. #include <ts.h>
  7. #include <stdio.h>
  8.  
  9. /**********
  10. * CREL( CN )
  11. * This function releases CN from curproc
  12. **********/
  13. void crel( cn )
  14. CHAN *cn ;
  15. {
  16.   PROCESS **ppp, *pp;
  17.   int cpuflags ;
  18.  
  19.   cpuflags = cli() ;                /* hold interrupts */
  20.   
  21.   if( curproc == cn->wf || curproc == cn->rf ) {
  22.  
  23.       /*set ppp to the channel's wf or rf member*/
  24.       ppp = (cn->wf == curproc) ? &cn->wf : &cn->rf ;
  25.       if( *ppp == curproc )    {          /*if curproc holds this channel*/
  26.         *ppp = pp = (*ppp)->chnxt;    /*remove curproc from waiting list*/
  27.         if( pp )                  /*if any task waits, wake it up*/
  28.           pp->status &= ~CHANWAIT;
  29.         curproc->chnxt = NULL;        /*reset chnxt pointer*/
  30.       }
  31.  
  32.       curproc->chlev--;        /*update channel request level*/
  33.   }
  34.   ts_rrip();            /*check if should die*/
  35.   putf( cpuflags );
  36.   return;
  37. }
  38.  
  39.  
  40.