From: Richard M. Stallman Date: Tue, 16 Apr 1996 20:41:24 +0000 (+0000) Subject: (check_timer): Removed; use gettime instead. X-Git-Tag: emacs-19.34~828 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2636719334831a1b7ca1c2af9a0e6fd240160f89;p=emacs.git (check_timer): Removed; use gettime instead. (sys_select): Call __dpmi_yield while waiting for input to improve multitasking behaviour. Do not check timer when no timeout. --- diff --git a/src/msdos.c b/src/msdos.c index 7eba18ed6b2..05f5f4670e4 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -2696,29 +2696,6 @@ unrequest_sigio () {} #ifndef HAVE_SELECT #include "sysselect.h" -static struct time last_time = {120, 120, 120, 120}; - -static void -check_timer (t) - struct time *t; -{ - int sec, min, hour, hund; - - gettime (t); - sec = t->ti_sec; - hund = t->ti_hund; - hour = t->ti_hour; - min = t->ti_min; - - /* Any chance of not getting here 24 hours or more since last time? */ - if (hour == last_time.ti_hour - && min == last_time.ti_min - && sec == last_time.ti_sec) - return; - - last_time = *t; -} - #ifndef EMACS_TIME_ZERO_OR_NEG_P #define EMACS_TIME_ZERO_OR_NEG_P(time) \ ((long)(time).tv_sec < 0 \ @@ -2757,25 +2734,28 @@ sys_select (nfds, rfds, wfds, efds, timeout) just read it and wait -- that's more efficient. */ if (!timeout) { - do - check_timer (&t); /* check timer even if some input is pending */ - while (!detect_input_pending ()); + while (!detect_input_pending ()) + { +#if __DJGPP__ >= 2 + __dpmi_yield (); +#endif + } } else { EMACS_TIME clnow, cllast, cldiff; - check_timer (&t); + gettime (&t); EMACS_SET_SECS_USECS (cllast, t.ti_sec, t.ti_hund * 10000L); while (!check_input || !detect_input_pending ()) { - check_timer (&t); + gettime (&t); EMACS_SET_SECS_USECS (clnow, t.ti_sec, t.ti_hund * 10000L); EMACS_SUB_TIME (cldiff, clnow, cllast); /* When seconds wrap around, we assume that no more than - 1 minute passed since last `check_timer'. */ + 1 minute passed since last `gettime'. */ if (EMACS_TIME_NEG_P (cldiff)) EMACS_SET_SECS (cldiff, EMACS_SECS (cldiff) + 60); EMACS_SUB_TIME (*timeout, *timeout, cldiff); @@ -2784,6 +2764,9 @@ sys_select (nfds, rfds, wfds, efds, timeout) if (EMACS_TIME_ZERO_OR_NEG_P (*timeout)) return 0; cllast = clnow; +#if __DJGPP__ >= 2 + __dpmi_yield (); +#endif } }