changeset 83053:84bfe7168c06

Block more input during read_avail_input. src/keyboard.c (read_avail_input): Added BLOCK_INPUT. Return -1 when input is blocked or if we could not read input and a display's input hook signalled an error. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-93
author Karoly Lorentey <lorentey@elte.hu>
date Tue, 24 Feb 2004 18:00:36 +0000
parents 011894b9950a
children bc4c00966ad3
files src/keyboard.c
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Fri Feb 20 23:54:53 2004 +0000
+++ b/src/keyboard.c	Tue Feb 24 18:00:36 2004 +0000
@@ -6586,8 +6586,17 @@
 {
   register int i;
   int nread = 0;
+  int err;
   struct display *d;
 
+  if (interrupt_input_blocked)
+    {
+      interrupt_input_pending = 1;
+      return -1;
+    }
+
+  BLOCK_INPUT;
+
   /* Loop through the available displays, and call their input hooks. */
   d = display_list;
   while (d)
@@ -6625,6 +6634,10 @@
                       discard = 1;
                   }
               }
+            else if (nr == -1)          /* Not OK to read input now. */
+              {
+                err = 1;
+              }
             else if (nr == -2)          /* Non-transient error. */
               {
                 /* The display device terminated; it should be closed. */
@@ -6653,6 +6666,11 @@
       d = next;
     }
 
+  if (err && !nread)
+    nread = -1;
+
+  UNBLOCK_INPUT;
+
   return nread;
 }