+2013-12-12 Dmitry Antipov <dmantipov@yandex.ru>
+
+ * xterm.c (x_make_frame_visible): Restore hack which is needed when
+ input polling is used. This is still meaningful for Cygwin, see
+ http://lists.gnu.org/archive/html/emacs-devel/2013-12/msg00351.html.
+ * keyboard.c (poll_for_input_1, input_polling_used): Define
+ unconditionally.
+
2013-12-11 Ken Brown <kbrown@cornell.edu>
* dispextern.h (erase_phys_cursor):
static struct atimer *poll_timer;
-#ifdef HAVE_NTGUI
/* Poll for input, so that we catch a C-g if it comes in. */
void
poll_for_input_1 (void)
&& !waiting_for_input)
gobble_input ();
}
-#endif
/* Timer callback function for poll_timer. TIMER is equal to
poll_timer. */
#endif
}
-#ifdef HAVE_NTGUI
-
/* True if we are using polling to handle input asynchronously. */
bool
return 0;
#endif
}
-#endif
/* Turn off polling. */
{
/* Force processing of queued events. */
x_sync (f);
+
+ /* This hack is still in use at least for Cygwin. See
+ http://lists.gnu.org/archive/html/emacs-devel/2013-12/msg00351.html.
+
+ Machines that do polling rather than SIGIO have been
+ observed to go into a busy-wait here. So we'll fake an
+ alarm signal to let the handler know that there's something
+ to be read. We used to raise a real alarm, but it seems
+ that the handler isn't always enabled here. This is
+ probably a bug. */
+ if (input_polling_used ())
+ {
+ /* It could be confusing if a real alarm arrives while
+ processing the fake one. Turn it off and let the
+ handler reset it. */
+ int old_poll_suppress_count = poll_suppress_count;
+ poll_suppress_count = 1;
+ poll_for_input_1 ();
+ poll_suppress_count = old_poll_suppress_count;
+ }
+
if (XPending (FRAME_X_DISPLAY (f)))
{
XEvent xev;