If NSECS > 0, the timeout consists of NSECS only.
If NSECS < 0, gobble data immediately, as if TIME_LIMIT were negative.
- READ_KBD is a lisp value:
+ READ_KBD is:
0 to ignore keyboard input, or
1 to return when input is available, or
-1 meaning caller will actually read the input, so don't throw to
If NSECS > 0, the timeout consists of NSECS only.
If NSECS < 0, gobble data immediately, as if TIME_LIMIT were negative.
- READ_KBD is a Lisp_Object:
+ READ_KBD is:
0 to ignore keyboard input, or
1 to return when input is available, or
-1 means caller will actually read the input, so don't throw to
{
register int nfds;
EMACS_TIME end_time, timeout;
- SELECT_TYPE waitchannels;
- int xerrno;
if (time_limit < 0)
{
while (1)
{
int timeout_reduced_for_timers = 0;
+ SELECT_TYPE waitchannels;
+ int xerrno;
/* If calling from keyboard input, do not quit
since we want to return C-g as an input character.
if (read_kbd < 0)
set_waiting_for_input (&timeout);
- /* Wait till there is something to do. */
-
- if (! read_kbd && NILP (wait_for_cell))
- FD_ZERO (&waitchannels);
- else
- FD_SET (0, &waitchannels);
-
/* If a frame has been newly mapped and needs updating,
reprocess its display stuff. */
if (frame_garbaged && do_display)
set_waiting_for_input (&timeout);
}
+ /* Wait till there is something to do. */
+ FD_ZERO (&waitchannels);
if (read_kbd && detect_input_pending ())
+ nfds = 0;
+ else
{
- nfds = 0;
- FD_ZERO (&waitchannels);
+ if (read_kbd || !NILP (wait_for_cell))
+ FD_SET (0, &waitchannels);
+ nfds = pselect (1, &waitchannels, NULL, NULL, &timeout, NULL);
}
- else
- nfds = pselect (1, &waitchannels, NULL, NULL, &timeout, NULL);
xerrno = errno;