[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MiNT 1.09: Busy wait on console input



MiNT currently consumes too much cpu time for processes waiting on
console input, even if the patch (sorry, i forget by whom) is applied
that replaces yield() by nap(60).  (The latter has the disadvantage
that it generates many debug messages from kmalloc/kfree when
debug_level is set to LOW_LEVEL.)  But the console is a very slow
device on the read side.  Since it is interrupt driven, it is easy to
change this to use sleep().  Once select() works on the other bios
devices we can change that too.

--- orig/bios.c	Tue Jul 27 19:51:48 1993
+++ bios.c	Tue Dec 14 20:30:52 1993
@@ -37,6 +37,8 @@
 
 char *kbshft;		/* set in main.c */
 
+short console_in;	/* wait condition for console input */
+
 /* some BIOS vectors; note that the routines at these vectors may do nasty
  * things to registers!
  */
@@ -165,7 +167,7 @@
 		k = keyrec;
 again:
 		while (k->tail == k->head) {
-			yield();
+			sleep (IO_Q, (long) &console_in);
 		}
 
 		if (checkkeys()) goto again;
@@ -811,6 +811,10 @@
 /* has someone done select() on the keyboard?? */
 	if (tty->rsel && keyrec->head != keyrec->tail)
 		wakeselect(tty->rsel);
+
+	/* wake up any processes waiting in bconin() */
+	if (keyrec->head != keyrec->tail)
+	  wake (IO_Q, (long) &console_in);
 
 	return ret;
 }