|
|
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;
1.1.1.2 ! root 14: WORD msg;
1.1 root 15:
1.1.1.2 ! root 16: disable();
1.1 root 17: pptr = &proctab[currpid];
1.1.1.2 ! root 18: if (pptr->phasmsg == 0) {
1.1 root 19: pptr->pstate = PRRECV;
20: resched();
21: }
1.1.1.2 ! root 22: msg = pptr->pmsg;
! 23: pptr->phasmsg = 0;
! 24: restore();
1.1 root 25: return(msg);
26: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.