code:plock - ikarishinjieva/unixV6-code-analyze-chs GitHub Wiki
- 将 一个管道结构(struct inode) 置锁
- 若已锁,则 进程睡眠等待
7857
7858 /* Lock a pipe.
7859 * If its already locked,
7860 * set the WANT bit and sleep.
7861 */
7862 plock(ip)
7863 int *ip;
7864 {
7865 register *rp;
7866
7867 rp = ip;
7868 while(rp->i_flag&ILOCK) {
7869 rp->i_flag =| IWANT;
7870 sleep(rp, PPIPE);
7871 }
7872 rp->i_flag =| ILOCK;
7873 }
7874 /* ------------------------- */