Use this to make the tty code behave better
CODE2 void doexit (int16_t val, int16_t val2);
CODE2 void panic(char *deathcry);
CODE2 void exec_or_die(void);
+#define need_resched() (nready != 1 && runticks >= udata.u_ptab->p_priority)
+
/* select.c */
CODE2 extern void seladdwait(struct selmap *s);
ptty_putc_wait(minor, c);
else
#endif
+ /* For slower platforms it's not worth the task switching and return
+ costs versus waiting a bit. A box with tx interrupts and sufficient
+ performance can buffer or sleep in in tty_putc instead. */
if (!udata.u_ininterrupt) {
while (!tty_writeready(minor))
- psleep(&ttydata[minor]);
+ if (need_resched())
+ psleep(&ttydata[minor]);
}
tty_putc(minor, c);
}