changeset 2894:646c5beae647

* process.c (wait_reading_process_input): Undo change of April 29th, since that re-introduces the race condition the comments are warning about. Call clear_waiting_for_input before calling status_notify, though.
author Jim Blandy <jimb@redhat.com>
date Wed, 19 May 1993 05:41:37 +0000
parents 4df57953d5d0
children 1ed91566882a
files src/process.c
diffstat 1 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/process.c	Wed May 19 05:05:46 1993 +0000
+++ b/src/process.c	Wed May 19 05:41:37 1993 +0000
@@ -1747,6 +1747,15 @@
 	  EMACS_SET_SECS_USECS (timeout, 100000, 0);
 	}
 
+      /* Cause C-g and alarm signals to take immediate action,
+	 and cause input available signals to zero out timeout.
+
+	 It is important that we do this before checking for process
+	 activity.  If we get a SIGCHLD after the explicit checks for
+	 process activity, timeout is the only way we will know.  */
+      if (XINT (read_kbd) < 0)
+	set_waiting_for_input (&timeout);
+
       /* If status of something has changed, and no input is
 	 available, notify the user of the change right away.  After
 	 this explicit check, we'll let the SIGCHLD handler zap
@@ -1756,18 +1765,14 @@
 	  Atemp = input_wait_mask;
 	  EMACS_SET_SECS_USECS (timeout, 0, 0);
 	  if (select (MAXDESC, &Atemp, 0, 0, &timeout) <= 0)
-	    status_notify ();
+	    {
+	      /* It's okay for us to do this and then continue with
+		 the loop, since timeout has already been zeroed out. */
+	      clear_waiting_for_input ();
+	      status_notify ();
+	    }
 	}
 
-      /* Cause C-g and alarm signals to take immediate action,
-	 and cause input available signals to zero out timeout.
-
-	 It is important that we do this before checking for process
-	 activity.  If we get a SIGCHLD after the explicit checks for
-	 process activity, timeout is the only way we will know.  */
-      if (XINT (read_kbd) < 0)
-	set_waiting_for_input (&timeout);
-
       /* Don't wait for output from a non-running process.  */
       if (wait_proc != 0 && !NILP (wait_proc->raw_status_low))
 	update_status (wait_proc);