code:wflushtty - ikarishinjieva/unixV6-code-analyze-chs GitHub Wiki

Source

  • 等待 指定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();

  • 处理机优先级设为5
  • 防止 有新的输出字符 进入
8223     while (tp->t_outq.c_cc) {

8224          tp->t_state =| ASLEEP;

8225          sleep(&tp->t_outq, TTOPRI);

8226     }

8227     flushtty(tp);
  • 清空 tty 队列
8228     spl0();
8229 }

8230 /* ------------------------- */

Ref

Caller

⚠️ **GitHub.com Fallback** ⚠️