home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / s / s001 / 1.ddi / TS / SRC / WAKEPROC.C < prev   
Encoding:
C/C++ Source or Header  |  1987-08-08  |  1.0 KB  |  34 lines

  1.                 /******************************************
  2.            *          WAKEPROC.C             *
  3.                * Copyright TimeSlice, Inc. 1985, 86, 87. *
  4.                ******************************************/
  5.  
  6. #include <ts.h>
  7.  
  8. /***
  9. * WAKEPROC( PPTR, EVENT )
  10. * This function wakes up the process pointed by PPTR, and places it 
  11. * in front of the process list. The process structure of the task awakened,
  12. * has its event member set to EVENT.
  13. ***/
  14. void wakeproc( pptr , event )
  15. PROCESS    *pptr;
  16. int    event;
  17. {
  18.   PROCESS *pp ;
  19.  
  20.   if( curproc != pptr ) {            /*if not currently running*/
  21.     ssleep();                    /*put switcher to sleep */
  22.     for( pp = curproc ; pp->nxt != pptr && pp->nxt != curproc; pp = pp->nxt );
  23.     if ( pp->nxt != curproc ) {            /*if process exists*/
  24.       pp->nxt = pptr->nxt;            /*place pptr in front of ...*/
  25.       pptr->nxt = curproc->nxt;            /*...process list*/
  26.       curproc->nxt = pptr;
  27.     }
  28.     swake();                    /*wake up switcher*/
  29.   }
  30.   pptr->status &= ~ASLEEP ;            /*wake up pptr*/
  31.   pptr->event = event;                /*tell pptr what woke it up*/
  32. }
  33.  
  34.