diff options
| author | Lars Ingebrigtsen | 2021-11-07 04:55:02 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-11-07 04:55:02 +0100 |
| commit | 858868e36dbb8fe30fb5ae6a59ebb2fd123e307d (patch) | |
| tree | 05290443967241f66d34d6bac842f3c10560001d /src | |
| parent | e20c27c770e3245c9934d82ccf66068d0a88b495 (diff) | |
| download | emacs-858868e36dbb8fe30fb5ae6a59ebb2fd123e307d.tar.gz emacs-858868e36dbb8fe30fb5ae6a59ebb2fd123e307d.zip | |
Actually start the alarms in atimer
* src/atimer.c (set_alarm): Actually start both timerfd and
alarms (attempted in 4107549a).
Diffstat (limited to 'src')
| -rw-r--r-- | src/atimer.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/atimer.c b/src/atimer.c index ab47bbf9688..490c21bff16 100644 --- a/src/atimer.c +++ b/src/atimer.c | |||
| @@ -305,6 +305,7 @@ set_alarm (void) | |||
| 305 | #ifdef HAVE_ITIMERSPEC | 305 | #ifdef HAVE_ITIMERSPEC |
| 306 | if (0 <= timerfd || alarm_timer_ok) | 306 | if (0 <= timerfd || alarm_timer_ok) |
| 307 | { | 307 | { |
| 308 | bool exit = false; | ||
| 308 | struct itimerspec ispec; | 309 | struct itimerspec ispec; |
| 309 | ispec.it_value = atimers->expiration; | 310 | ispec.it_value = atimers->expiration; |
| 310 | ispec.it_interval.tv_sec = ispec.it_interval.tv_nsec = 0; | 311 | ispec.it_interval.tv_sec = ispec.it_interval.tv_nsec = 0; |
| @@ -312,11 +313,14 @@ set_alarm (void) | |||
| 312 | if (timerfd_settime (timerfd, TFD_TIMER_ABSTIME, &ispec, 0) == 0) | 313 | if (timerfd_settime (timerfd, TFD_TIMER_ABSTIME, &ispec, 0) == 0) |
| 313 | { | 314 | { |
| 314 | add_timer_wait_descriptor (timerfd); | 315 | add_timer_wait_descriptor (timerfd); |
| 315 | return; | 316 | exit = true; |
| 316 | } | 317 | } |
| 317 | # endif | 318 | # endif |
| 318 | if (alarm_timer_ok | 319 | if (alarm_timer_ok |
| 319 | && timer_settime (alarm_timer, TIMER_ABSTIME, &ispec, 0) == 0) | 320 | && timer_settime (alarm_timer, TIMER_ABSTIME, &ispec, 0) == 0) |
| 321 | exit = true; | ||
| 322 | |||
| 323 | if (exit) | ||
| 320 | return; | 324 | return; |
| 321 | } | 325 | } |
| 322 | #endif | 326 | #endif |
| @@ -333,9 +337,8 @@ set_alarm (void) | |||
| 333 | memset (&it, 0, sizeof it); | 337 | memset (&it, 0, sizeof it); |
| 334 | it.it_value = make_timeval (interval); | 338 | it.it_value = make_timeval (interval); |
| 335 | setitimer (ITIMER_REAL, &it, 0); | 339 | setitimer (ITIMER_REAL, &it, 0); |
| 336 | #else /* not HAVE_SETITIMER */ | ||
| 337 | alarm (max (interval.tv_sec, 1)); | ||
| 338 | #endif /* not HAVE_SETITIMER */ | 340 | #endif /* not HAVE_SETITIMER */ |
| 341 | alarm (max (interval.tv_sec, 1)); | ||
| 339 | } | 342 | } |
| 340 | } | 343 | } |
| 341 | 344 | ||