code:wflushtty - ikarishinjieva/unixV6-code-analyze-chs GitHub Wiki
- 等待 指定tty输出队列元素 全部输出
- 清空 指定tty 的队列
8216 /* Wait for output to drain, then flush output waiting. */
8217 wflushtty(atp)
8218 struct tty *atp;
8219 {
8220 register struct tty *tp;
8221 tp = atp;
8222 spl5();
8223 while (tp->t_outq.c_cc) {
- 处理机优先级设为5
- 防止 有新的输出字符 进入
8224 tp->t_state =| ASLEEP;
8225 sleep(&tp->t_outq, TTOPRI);
8226 }
8227 flushtty(tp);
- 等待 输出队列元素 全部输出
- 等待时睡眠
- 睡眠原因 : struct clist
- 睡眠优先级 : TTOPRI
8228 spl0();
- 清空 tty 队列
8229 }
8230 /* ------------------------- */