Fix a race condition where we might stop outputting if a write follows a

flush too closely.
This commit is contained in:
mycroft 1996-02-18 09:10:15 +00:00
parent 6c52b1a5eb
commit e5730c4a73
2 changed files with 6 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: com.c,v 1.67 1996/02/17 04:51:41 mycroft Exp $ */ /* $NetBSD: com.c,v 1.68 1996/02/18 09:10:15 mycroft Exp $ */
/*- /*-
* Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved. * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved.
@ -832,7 +832,7 @@ comstart(tp)
int s; int s;
s = spltty(); s = spltty();
if (ISSET(tp->t_state, TS_TTSTOP | TS_BUSY)) if (ISSET(tp->t_state, TS_TIMEOUT | TS_TTSTOP | TS_BUSY))
goto out; goto out;
if (sc->sc_halt > 0) if (sc->sc_halt > 0)
goto out; goto out;
@ -1066,11 +1066,9 @@ comintr(arg)
} }
if (ISSET(lsr, LSR_TXRDY) && ISSET(tp->t_state, TS_BUSY)) { if (ISSET(lsr, LSR_TXRDY) && ISSET(tp->t_state, TS_BUSY)) {
CLR(tp->t_state, TS_BUSY); CLR(tp->t_state, TS_BUSY | TS_FLUSH);
if (sc->sc_halt > 0) if (sc->sc_halt > 0)
wakeup(&tp->t_outq); wakeup(&tp->t_outq);
else if (ISSET(tp->t_state, TS_FLUSH))
CLR(tp->t_state, TS_FLUSH);
else else
(*linesw[tp->t_line].l_start)(tp); (*linesw[tp->t_line].l_start)(tp);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: com.c,v 1.67 1996/02/17 04:51:41 mycroft Exp $ */ /* $NetBSD: com.c,v 1.68 1996/02/18 09:10:15 mycroft Exp $ */
/*- /*-
* Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved. * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved.
@ -832,7 +832,7 @@ comstart(tp)
int s; int s;
s = spltty(); s = spltty();
if (ISSET(tp->t_state, TS_TTSTOP | TS_BUSY)) if (ISSET(tp->t_state, TS_TIMEOUT | TS_TTSTOP | TS_BUSY))
goto out; goto out;
if (sc->sc_halt > 0) if (sc->sc_halt > 0)
goto out; goto out;
@ -1066,11 +1066,9 @@ comintr(arg)
} }
if (ISSET(lsr, LSR_TXRDY) && ISSET(tp->t_state, TS_BUSY)) { if (ISSET(lsr, LSR_TXRDY) && ISSET(tp->t_state, TS_BUSY)) {
CLR(tp->t_state, TS_BUSY); CLR(tp->t_state, TS_BUSY | TS_FLUSH);
if (sc->sc_halt > 0) if (sc->sc_halt > 0)
wakeup(&tp->t_outq); wakeup(&tp->t_outq);
else if (ISSET(tp->t_state, TS_FLUSH))
CLR(tp->t_state, TS_FLUSH);
else else
(*linesw[tp->t_line].l_start)(tp); (*linesw[tp->t_line].l_start)(tp);
} }