?? send.c
字號:
/* send.c - send */
#include <conf.h>
#include <kernel.h>
#include <proc.h>
/*------------------------------------------------------------------------
* send -- send a message to another process
*------------------------------------------------------------------------
*/
SYSCALL
send(int pid, WORD msg)
{
STATWORD ps;
struct pentry *pptr;
disable(ps);
if (isbadpid(pid) || ( (pptr= &proctab[pid])->pstate == PRFREE)
|| pptr->phasmsg != 0) {
restore(ps);
return(SYSERR);
}
pptr->pmsg = msg;
pptr->phasmsg = TRUE;
if (pptr->pstate == PRRECV) /* if receiver waits, start it */
ready(pid, RESCHYES);
else if (pptr->pstate == PRTRECV) {
unsleep(pid);
ready(pid, RESCHYES);
}
restore(ps);
return(OK);
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -