Brought in change from rev 1.11: fix race condition.

This commit is contained in:
David Greenman committed 1995-08-20 00:23:50 +00:00
1 parent 1ba919e206
commit 4e72be1c56
1 file changed
+14 -16
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/stable/2.1/; revision=10119
+14 -16
View File
@@ -932,10 +932,6 @@ pcrint(void)
#if PCVT_NETBSD || PCVT_FREEBSD >= 200
#if PCVT_NETBSD == 9
extern void ttrstrt();
#endif /* PCVT_NETBSD == 9 */
void
pcstart(register struct tty *tp)
{
@@ -954,26 +950,28 @@ pcstart(register struct tty *tp)
async_update(UPDATE_KERN);
/*
* We need to do this outside spl since it could be fairly
* expensive and we don't want our serial ports to overflow.
*/
rbp = &tp->t_outq;
while (len = q_to_b(rbp, buf, PCVT_PCBURST))
sput(&buf[0], 0, len, minor(tp->t_dev));
/*
* Call q_to_b() at spltty() to ensure that the queue is empty when
* the loop terminates.
*/
s = spltty();
tp->t_state &= ~TS_BUSY;
if (rbp->c_cc)
while (len = q_to_b(rbp, buf, PCVT_PCBURST))
{
tp->t_state |= TS_TIMEOUT;
timeout(ttrstrt, tp, 1);
/*
* We need to do this outside spl since it could be fairly
* expensive and we don't want our serial ports to overflow.
*/
splx(s);
sput(&buf[0], 0, len, minor(tp->t_dev));
s = spltty();
}
tp->t_state &= ~TS_BUSY;
if (rbp->c_cc <= tp->t_lowat)
{
if (tp->t_state&TS_ASLEEP)