}
}
+/* Return TRUE if the keyboard descriptor is being monitored by the
+ current thread, FALSE otherwise. */
+static bool
+kbd_is_ours (void)
+{
+ for (int fd = 0; fd <= max_desc; ++fd)
+ {
+ if (fd_callback_info[fd].waiting_thread != current_thread)
+ continue;
+ if ((fd_callback_info[fd].flags & (FOR_READ | KEYBOARD_FD))
+ == (FOR_READ | KEYBOARD_FD))
+ return true;
+ }
+ return false;
+}
+
\f
/* Compute the Lisp form of the process status, p->status, from
the numeric status that was returned by `wait'. */
wait_reading_process_output_1 ();
}
- /* Cause C-g and alarm signals to take immediate action,
+ /* Cause C-g 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 (read_kbd < 0)
+ if (read_kbd < 0 && kbd_is_ours ())
set_waiting_for_input (&timeout);
/* If status of something has changed, and no input is
{
clear_waiting_for_input ();
redisplay_preserve_echo_area (11);
- if (read_kbd < 0)
+ if (read_kbd < 0 && kbd_is_ours ())
set_waiting_for_input (&timeout);
}