aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1996-04-16 20:41:24 +0000
committerRichard M. Stallman1996-04-16 20:41:24 +0000
commit2636719334831a1b7ca1c2af9a0e6fd240160f89 (patch)
tree2faba35239c8e724b39f04401669dc96b7149790 /src
parent079242944aa2d211ea7ad368d3e9026272276cb6 (diff)
downloademacs-2636719334831a1b7ca1c2af9a0e6fd240160f89.tar.gz
emacs-2636719334831a1b7ca1c2af9a0e6fd240160f89.zip
(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.
Diffstat (limited to 'src')
-rw-r--r--src/msdos.c41
1 files changed, 12 insertions, 29 deletions
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 () {}
2696#ifndef HAVE_SELECT 2696#ifndef HAVE_SELECT
2697#include "sysselect.h" 2697#include "sysselect.h"
2698 2698
2699static struct time last_time = {120, 120, 120, 120};
2700
2701static void
2702check_timer (t)
2703 struct time *t;
2704{
2705 int sec, min, hour, hund;
2706
2707 gettime (t);
2708 sec = t->ti_sec;
2709 hund = t->ti_hund;
2710 hour = t->ti_hour;
2711 min = t->ti_min;
2712
2713 /* Any chance of not getting here 24 hours or more since last time? */
2714 if (hour == last_time.ti_hour
2715 && min == last_time.ti_min
2716 && sec == last_time.ti_sec)
2717 return;
2718
2719 last_time = *t;
2720}
2721
2722#ifndef EMACS_TIME_ZERO_OR_NEG_P 2699#ifndef EMACS_TIME_ZERO_OR_NEG_P
2723#define EMACS_TIME_ZERO_OR_NEG_P(time) \ 2700#define EMACS_TIME_ZERO_OR_NEG_P(time) \
2724 ((long)(time).tv_sec < 0 \ 2701 ((long)(time).tv_sec < 0 \
@@ -2757,25 +2734,28 @@ sys_select (nfds, rfds, wfds, efds, timeout)
2757 just read it and wait -- that's more efficient. */ 2734 just read it and wait -- that's more efficient. */
2758 if (!timeout) 2735 if (!timeout)
2759 { 2736 {
2760 do 2737 while (!detect_input_pending ())
2761 check_timer (&t); /* check timer even if some input is pending */ 2738 {
2762 while (!detect_input_pending ()); 2739#if __DJGPP__ >= 2
2740 __dpmi_yield ();
2741#endif
2742 }
2763 } 2743 }
2764 else 2744 else
2765 { 2745 {
2766 EMACS_TIME clnow, cllast, cldiff; 2746 EMACS_TIME clnow, cllast, cldiff;
2767 2747
2768 check_timer (&t); 2748 gettime (&t);
2769 EMACS_SET_SECS_USECS (cllast, t.ti_sec, t.ti_hund * 10000L); 2749 EMACS_SET_SECS_USECS (cllast, t.ti_sec, t.ti_hund * 10000L);
2770 2750
2771 while (!check_input || !detect_input_pending ()) 2751 while (!check_input || !detect_input_pending ())
2772 { 2752 {
2773 check_timer (&t); 2753 gettime (&t);
2774 EMACS_SET_SECS_USECS (clnow, t.ti_sec, t.ti_hund * 10000L); 2754 EMACS_SET_SECS_USECS (clnow, t.ti_sec, t.ti_hund * 10000L);
2775 EMACS_SUB_TIME (cldiff, clnow, cllast); 2755 EMACS_SUB_TIME (cldiff, clnow, cllast);
2776 2756
2777 /* When seconds wrap around, we assume that no more than 2757 /* When seconds wrap around, we assume that no more than
2778 1 minute passed since last `check_timer'. */ 2758 1 minute passed since last `gettime'. */
2779 if (EMACS_TIME_NEG_P (cldiff)) 2759 if (EMACS_TIME_NEG_P (cldiff))
2780 EMACS_SET_SECS (cldiff, EMACS_SECS (cldiff) + 60); 2760 EMACS_SET_SECS (cldiff, EMACS_SECS (cldiff) + 60);
2781 EMACS_SUB_TIME (*timeout, *timeout, cldiff); 2761 EMACS_SUB_TIME (*timeout, *timeout, cldiff);
@@ -2784,6 +2764,9 @@ sys_select (nfds, rfds, wfds, efds, timeout)
2784 if (EMACS_TIME_ZERO_OR_NEG_P (*timeout)) 2764 if (EMACS_TIME_ZERO_OR_NEG_P (*timeout))
2785 return 0; 2765 return 0;
2786 cllast = clnow; 2766 cllast = clnow;
2767#if __DJGPP__ >= 2
2768 __dpmi_yield ();
2769#endif
2787 } 2770 }
2788 } 2771 }
2789 2772