]> git.eshelyaron.com Git - emacs.git/commitdiff
Add comments and `volatile' keyword to previous change.
authorKarl Heuer <kwzh@gnu.org>
Wed, 25 Jan 1995 08:55:43 +0000 (08:55 +0000)
committerKarl Heuer <kwzh@gnu.org>
Wed, 25 Jan 1995 08:55:43 +0000 (08:55 +0000)
src/lisp.h

index 1adf5433863470238e9c5ac362eadaffc18654c8..49e87ee98d6e2ffb965d05471da9c81fe121ce96 100644 (file)
@@ -491,9 +491,30 @@ typedef struct
     Lisp_Object this_command_keys;
     Lisp_Object internal_last_event_frame;
     Lisp_Object kbd_buffer_frame_or_window;
+
+    /* Circular buffer for pre-read keyboard input.  */
     struct input_event *kbd_buffer;
+
+    /* Pointer to next available character in kbd_buffer.
+       If kbd_fetch_ptr == kbd_store_ptr, the buffer is empty.
+       This may be kbd_buffer + KBD_BUFFER_SIZE, meaning that the the
+       next available char is in kbd_buffer[0].  */
     struct input_event *kbd_fetch_ptr;
-    struct input_event *kbd_store_ptr;
+
+    /* Pointer to next place to store character in kbd_buffer.  This
+       may be kbd_buffer + KBD_BUFFER_SIZE, meaning that the next
+       character should go in kbd_buffer[0].  */
+    volatile struct input_event *kbd_store_ptr;
+
+    /* The above pair of variables forms a "queue empty" flag.  When we
+       enqueue a non-hook event, we increment kbd_store_ptr.  When we
+       dequeue a non-hook event, we increment kbd_fetch_ptr.  We say that
+       there is input available iff the two counters are not equal.
+
+       Why not just have a flag set and cleared by the enqueuing and
+       dequeuing functions?  Such a flag could be screwed up by interrupts
+       at inopportune times.  */
+
     int this_command_key_count;
     int immediate_echo;
     int echo_after_prompt;