home *** CD-ROM | disk | FTP | other *** search
- /******************************************
- * CREL.C *
- * Copyright TimeSlice, Inc. 1985, 86, 87. *
- ******************************************/
-
- #include <ts.h>
- #include <stdio.h>
-
- /**********
- * CREL( CN )
- * This function releases CN from curproc
- **********/
- void crel( cn )
- CHAN *cn ;
- {
- PROCESS **ppp, *pp;
- int cpuflags ;
-
- cpuflags = cli() ; /* hold interrupts */
-
- if( curproc == cn->wf || curproc == cn->rf ) {
-
- /*set ppp to the channel's wf or rf member*/
- ppp = (cn->wf == curproc) ? &cn->wf : &cn->rf ;
- if( *ppp == curproc ) { /*if curproc holds this channel*/
- *ppp = pp = (*ppp)->chnxt; /*remove curproc from waiting list*/
- if( pp ) /*if any task waits, wake it up*/
- pp->status &= ~CHANWAIT;
- curproc->chnxt = NULL; /*reset chnxt pointer*/
- }
-
- curproc->chlev--; /*update channel request level*/
- }
- ts_rrip(); /*check if should die*/
- putf( cpuflags );
- return;
- }
-
-
-