Commit b65c1b44 authored by Stefan Monnier's avatar Stefan Monnier

(handle_async_input): New fun, extracted from input_available_signal.

(input_available_signal, reinvoke_input_signal): Use it.
parent d7107586
/* Keyboard and mouse input; editor command loop.
Copyright (C) 1985,86,87,88,89,93,94,95,96,97,99,2000,01,02,03
Copyright (C) 1985,86,87,88,89,93,94,95,96,97,99,2000,01,02,03,04
Free Software Foundation, Inc.
This file is part of GNU Emacs.
......@@ -6747,6 +6747,30 @@ read_avail_input (expected)
}
#endif /* not VMS */
void
handle_async_input ()
{
#ifdef BSD4_1
extern int select_alarmed;
#endif
interrupt_input_pending = 0;
while (1)
{
int nread;
nread = read_avail_input (1);
/* -1 means it's not ok to read the input now.
UNBLOCK_INPUT will read it later; now, avoid infinite loop.
0 means there was no keyboard input available. */
if (nread <= 0)
break;
#ifdef BSD4_1
select_alarmed = 1; /* Force the select emulator back to life */
#endif
}
}
#ifdef SIGIO /* for entire page */
/* Note SIGIO has been undef'd if FIONREAD is missing. */
......@@ -6756,9 +6780,6 @@ input_available_signal (signo)
{
/* Must preserve main program's value of errno. */
int old_errno = errno;
#ifdef BSD4_1
extern int select_alarmed;
#endif
#if defined (USG) && !defined (POSIX_SIGNALS)
/* USG systems forget handlers when they are used;
......@@ -6773,20 +6794,11 @@ input_available_signal (signo)
if (input_available_clear_time)
EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
while (1)
{
int nread;
nread = read_avail_input (1);
/* -1 means it's not ok to read the input now.
UNBLOCK_INPUT will read it later; now, avoid infinite loop.
0 means there was no keyboard input available. */
if (nread <= 0)
break;
#ifdef BSD4_1
select_alarmed = 1; /* Force the select emulator back to life */
#ifdef SYNC_INPUT
interrupt_input_pending = 1;
#else
handle_async_input ();
#endif
}
#ifdef BSD4_1
sigfree ();
......@@ -6805,7 +6817,7 @@ void
reinvoke_input_signal ()
{
#ifdef SIGIO
kill (getpid (), SIGIO);
handle_async_input ();
#endif
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment