diff --git a/src/main/select.c b/src/main/select.c index 2f4b1c933..fcd9f88cf 100644 --- a/src/main/select.c +++ b/src/main/select.c @@ -1272,10 +1272,8 @@ select_loop(void (*init)(void)) has_timer = get_next_timer_time(&t); if (!w_max && !has_timer) break; - critical_section = 1; if (check_signals()) { - critical_section = 0; continue; } #if 0 @@ -1309,8 +1307,6 @@ select_loop(void (*init)(void)) * might change errno. */ const int errno_from_select = errno; - critical_section = 0; - uninstall_alarm(); if (errno_from_select != EINTR) { ERROR(gettext("The call to %s failed: %d (%s)"), "select()", errno_from_select, (char *) strerror(errno_from_select)); @@ -1322,8 +1318,6 @@ select_loop(void (*init)(void)) } select_errors = 0; - critical_section = 0; - uninstall_alarm(); check_signals(); /*printf("sel: %d\n", n);*/ check_timers(&last_time); diff --git a/src/osdep/signals.c b/src/osdep/signals.c index 069d470af..6906320cd 100644 --- a/src/osdep/signals.c +++ b/src/osdep/signals.c @@ -245,9 +245,6 @@ struct signal_info { }; static struct signal_info signal_info[NUM_SIGNALS]; -volatile int critical_section = 0; - -static void check_for_select_race(void); /* TODO: In order to gain better portability, we should use signal() instead. * Highest care should be given to careful watching of which signals are @@ -276,7 +273,6 @@ got_signal(int sig) } s->mask = 1; - check_for_select_race(); if (can_write(signal_pipe[1])) { int wr; @@ -324,41 +320,6 @@ install_signal_handler(int sig, void (*fn)(void *), void *data, int critical) #endif } -static volatile int pending_alarm = 0; - -#ifdef SIGALRM -static void -alarm_handler(void *x) -{ - pending_alarm = 0; - check_for_select_race(); -} -#endif - -static void -check_for_select_race(void) -{ - if (critical_section) { -#ifdef SIGALRM - install_signal_handler(SIGALRM, alarm_handler, NULL, 1); -#endif - pending_alarm = 1; -#ifdef HAVE_ALARM - alarm(1); -#endif - } -} - -void -uninstall_alarm(void) -{ - pending_alarm = 0; -#ifdef HAVE_ALARM - alarm(0); -#endif -} - - #ifdef SIGCHLD static void sig_chld(void *p) diff --git a/src/osdep/signals.h b/src/osdep/signals.h index 37ba12e35..a3da70ccf 100644 --- a/src/osdep/signals.h +++ b/src/osdep/signals.h @@ -11,13 +11,10 @@ struct terminal; #define NUM_SIGNALS 32 -extern volatile int critical_section; - void install_signal_handler(int, void (*)(void *), void *, int); void set_sigcld(void); void sig_ctrl_c(struct terminal *term); void clear_signal_mask_and_handlers(void); -void uninstall_alarm(void); void handle_basic_signals(struct terminal *term); void unhandle_terminal_signals(struct terminal *term); int check_signals(void);