aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/sysdep.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/sysdep.c b/src/sysdep.c
index bce69a406ff..17c48fc7cbd 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -2475,7 +2475,7 @@ sys_select (nfds, rfds, wfds, efds, timeout)
2475 SELECT_TYPE *rfds, *wfds, *efds; 2475 SELECT_TYPE *rfds, *wfds, *efds;
2476 EMACS_TIME *timeout; 2476 EMACS_TIME *timeout;
2477{ 2477{
2478 int ravail = 0, old_alarm; 2478 int ravail = 0;
2479 SELECT_TYPE orfds; 2479 SELECT_TYPE orfds;
2480 int timeoutval; 2480 int timeoutval;
2481 int *local_timeout; 2481 int *local_timeout;
@@ -2485,7 +2485,6 @@ sys_select (nfds, rfds, wfds, efds, timeout)
2485#else 2485#else
2486 extern int process_tick, update_tick; 2486 extern int process_tick, update_tick;
2487#endif 2487#endif
2488 SIGTYPE (*old_trap) ();
2489 unsigned char buf; 2488 unsigned char buf;
2490 2489
2491#if defined (HAVE_SELECT) && defined (HAVE_X_WINDOWS) 2490#if defined (HAVE_SELECT) && defined (HAVE_X_WINDOWS)
@@ -2568,10 +2567,12 @@ sys_select (nfds, rfds, wfds, efds, timeout)
2568 } 2567 }
2569 if (*local_timeout == 0 || ravail != 0 || process_tick != update_tick) 2568 if (*local_timeout == 0 || ravail != 0 || process_tick != update_tick)
2570 break; 2569 break;
2571 old_alarm = alarm (0); 2570
2572 old_trap = signal (SIGALRM, select_alarm); 2571 turn_on_atimers (0);
2572 signal (SIGALRM, select_alarm);
2573 select_alarmed = 0; 2573 select_alarmed = 0;
2574 alarm (SELECT_PAUSE); 2574 alarm (SELECT_PAUSE);
2575
2575 /* Wait for a SIGALRM (or maybe a SIGTINT) */ 2576 /* Wait for a SIGALRM (or maybe a SIGTINT) */
2576 while (select_alarmed == 0 && *local_timeout != 0 2577 while (select_alarmed == 0 && *local_timeout != 0
2577 && process_tick == update_tick) 2578 && process_tick == update_tick)
@@ -2589,18 +2590,10 @@ sys_select (nfds, rfds, wfds, efds, timeout)
2589 pause (); 2590 pause ();
2590 } 2591 }
2591 (*local_timeout) -= SELECT_PAUSE; 2592 (*local_timeout) -= SELECT_PAUSE;
2592 /* Reset the old alarm if there was one */ 2593
2593 alarm (0); 2594 /* Reset the old alarm if there was one. */
2594 signal (SIGALRM, old_trap); 2595 turn_on_atimers (1);
2595 if (old_alarm != 0) 2596
2596 {
2597 /* Reset or forge an interrupt for the original handler. */
2598 old_alarm -= SELECT_PAUSE;
2599 if (old_alarm <= 0)
2600 kill (getpid (), SIGALRM); /* Fake an alarm with the orig' handler */
2601 else
2602 alarm (old_alarm);
2603 }
2604 if (*local_timeout == 0) /* Stop on timer being cleared */ 2597 if (*local_timeout == 0) /* Stop on timer being cleared */
2605 break; 2598 break;
2606 } 2599 }