]> git.eshelyaron.com Git - emacs.git/commitdiff
Actually start the alarms in atimer
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 7 Nov 2021 03:55:02 +0000 (04:55 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 7 Nov 2021 03:55:02 +0000 (04:55 +0100)
* src/atimer.c (set_alarm): Actually start both timerfd and
alarms (attempted in 4107549a).

src/atimer.c

index ab47bbf96882e27370c93b679a590aad61c5b54a..490c21bff16f93f200a074cf61b33686c541bc6b 100644 (file)
@@ -305,6 +305,7 @@ set_alarm (void)
 #ifdef HAVE_ITIMERSPEC
       if (0 <= timerfd || alarm_timer_ok)
        {
+         bool exit = false;
          struct itimerspec ispec;
          ispec.it_value = atimers->expiration;
          ispec.it_interval.tv_sec = ispec.it_interval.tv_nsec = 0;
@@ -312,11 +313,14 @@ set_alarm (void)
          if (timerfd_settime (timerfd, TFD_TIMER_ABSTIME, &ispec, 0) == 0)
            {
              add_timer_wait_descriptor (timerfd);
-             return;
+             exit = true;
            }
 # endif
          if (alarm_timer_ok
              && timer_settime (alarm_timer, TIMER_ABSTIME, &ispec, 0) == 0)
+           exit = true;
+
+         if (exit)
            return;
        }
 #endif
@@ -333,9 +337,8 @@ set_alarm (void)
       memset (&it, 0, sizeof it);
       it.it_value = make_timeval (interval);
       setitimer (ITIMER_REAL, &it, 0);
-#else /* not HAVE_SETITIMER */
-      alarm (max (interval.tv_sec, 1));
 #endif /* not HAVE_SETITIMER */
+      alarm (max (interval.tv_sec, 1));
     }
 }