diff options
| author | Yuuki Harano | 2019-07-19 00:15:52 +0900 |
|---|---|---|
| committer | Jeff Walsh | 2020-11-22 14:46:55 +1100 |
| commit | 9d9c8284fe224932f093e972b81e3c36fdce168b (patch) | |
| tree | d24b6013eabc38915a3f964482219347852640f9 /src | |
| parent | 6957f9469ca0503088abda4d55df59e26339afa9 (diff) | |
| download | emacs-9d9c8284fe224932f093e972b81e3c36fdce168b.tar.gz emacs-9d9c8284fe224932f093e972b81e3c36fdce168b.zip | |
TIMERFD support for PGTK, prevent calling when timerfd<0
* ../src/atimer.c (set_alarm):
Diffstat (limited to 'src')
| -rw-r--r-- | src/atimer.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/atimer.c b/src/atimer.c index a7daf9dcf5b..df123e11916 100644 --- a/src/atimer.c +++ b/src/atimer.c | |||
| @@ -309,11 +309,13 @@ set_alarm (void) | |||
| 309 | ispec.it_value = atimers->expiration; | 309 | ispec.it_value = atimers->expiration; |
| 310 | ispec.it_interval.tv_sec = ispec.it_interval.tv_nsec = 0; | 310 | ispec.it_interval.tv_sec = ispec.it_interval.tv_nsec = 0; |
| 311 | # ifdef HAVE_TIMERFD | 311 | # ifdef HAVE_TIMERFD |
| 312 | if (timerfd_settime (timerfd, TFD_TIMER_ABSTIME, &ispec, 0) == 0) | 312 | if (timerfd >= 0) { |
| 313 | { | 313 | if (timerfd_settime (timerfd, TFD_TIMER_ABSTIME, &ispec, 0) == 0) |
| 314 | add_timer_wait_descriptor (timerfd); | 314 | { |
| 315 | return; | 315 | add_timer_wait_descriptor (timerfd); |
| 316 | } | 316 | return; |
| 317 | } | ||
| 318 | } | ||
| 317 | # endif | 319 | # endif |
| 318 | if (alarm_timer_ok | 320 | if (alarm_timer_ok |
| 319 | && timer_settime (alarm_timer, TIMER_ABSTIME, &ispec, 0) == 0) | 321 | && timer_settime (alarm_timer, TIMER_ABSTIME, &ispec, 0) == 0) |
| @@ -461,7 +463,8 @@ turn_on_atimers (bool on) | |||
| 461 | if (alarm_timer_ok) | 463 | if (alarm_timer_ok) |
| 462 | timer_settime (alarm_timer, TIMER_ABSTIME, &ispec, 0); | 464 | timer_settime (alarm_timer, TIMER_ABSTIME, &ispec, 0); |
| 463 | # ifdef HAVE_TIMERFD | 465 | # ifdef HAVE_TIMERFD |
| 464 | timerfd_settime (timerfd, TFD_TIMER_ABSTIME, &ispec, 0); | 466 | if (timerfd >= 0) |
| 467 | timerfd_settime (timerfd, TFD_TIMER_ABSTIME, &ispec, 0); | ||
| 465 | # endif | 468 | # endif |
| 466 | #endif | 469 | #endif |
| 467 | alarm (0); | 470 | alarm (0); |
| @@ -568,6 +571,9 @@ have_buggy_timerfd (void) | |||
| 568 | # ifdef CYGWIN | 571 | # ifdef CYGWIN |
| 569 | struct utsname name; | 572 | struct utsname name; |
| 570 | return uname (&name) < 0 || strverscmp (name.release, "3.0.2") < 0; | 573 | return uname (&name) < 0 || strverscmp (name.release, "3.0.2") < 0; |
| 574 | # elif defined HAVE_PGTK | ||
| 575 | /* pgtk emacs does not want timerfd. */ | ||
| 576 | return true; | ||
| 571 | # else | 577 | # else |
| 572 | return false; | 578 | return false; |
| 573 | # endif | 579 | # endif |