Annotation of xinu/sys/receive.c, revision 1.1

1.1     ! root        1: /* receive.c - receive */
        !             2: 
        !             3: #include <conf.h>
        !             4: #include <kernel.h>
        !             5: #include <proc.h>
        !             6: 
        !             7: /*------------------------------------------------------------------------
        !             8:  *  receive  -  wait for a message and return it
        !             9:  *------------------------------------------------------------------------
        !            10:  */
        !            11: SYSCALL        receive()
        !            12: {
        !            13:        struct  pentry  *pptr;
        !            14:        int     msg;
        !            15:        PStype  ps;
        !            16: 
        !            17:        disable(ps);
        !            18:        pptr = &proctab[currpid];
        !            19:        if ( !pptr->phasmsg ) {         /* if no message, wait for one  */
        !            20:                pptr->pstate = PRRECV;
        !            21:                resched();
        !            22:        }
        !            23:        msg = pptr->pmsg;               /* retrieve message             */
        !            24:        pptr->phasmsg = FALSE;
        !            25:        restore(ps);
        !            26:        return(msg);
        !            27: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.