diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2014-07-28 18:50:55 +0400 |
---|---|---|
committer | Dmitry Antipov <dmantipov@yandex.ru> | 2014-07-28 18:50:55 +0400 |
commit | 2daa203c3eb983433b86b841bf31d3e91bb51ab4 (patch) | |
tree | 3e5c62bcf52d6ffea9254e6ce4f8a1393038d479 /src/atimer.c | |
parent | da41ffdd089b529c3d5216412d95840e065c3fe3 (diff) | |
download | emacs-2daa203c3eb983433b86b841bf31d3e91bb51ab4.tar.gz emacs-2daa203c3eb983433b86b841bf31d3e91bb51ab4.tar.bz2 emacs-2daa203c3eb983433b86b841bf31d3e91bb51ab4.zip |
Fix Gnus-related issues reported by David Kastrup <dak@gnu.org> in
<http://lists.gnu.org/archive/html/emacs-devel/2014-07/msg00370.html>.
* atimer.c (timerfd_callback): Always read expiration data.
Add comment.
(turn_on_atimers) [HAVE_TIMERFD]: Disarm timerfd timer.
* process.c (add_timer_wait_descriptor): Add timer descriptor
to input_wait_mask and non_process_wait_mask as well.
Diffstat (limited to 'src/atimer.c')
-rw-r--r-- | src/atimer.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/atimer.c b/src/atimer.c index 9079e7712e0..c03ac96c6da 100644 --- a/src/atimer.c +++ b/src/atimer.c @@ -410,9 +410,19 @@ handle_alarm_signal (int sig) #ifdef HAVE_TIMERFD +/* Called from wait_reading_process_output when FD, which + should be equal to TIMERFD, is available for reading. */ + void timerfd_callback (int fd, void *arg) { + char buf[8]; + ptrdiff_t nbytes; + + eassert (fd == timerfd); + nbytes = emacs_read (fd, buf, sizeof (buf)); + /* Just discard an expiration count for now. */ + eassert (nbytes == sizeof (buf)); do_pending_atimers (); } @@ -442,7 +452,18 @@ turn_on_atimers (bool on) if (on) set_alarm (); else - alarm (0); + { +#ifdef HAVE_TIMERFD + if (special_timer_available > 1) + { + struct itimerspec ispec; + memset (&ispec, 0, sizeof (ispec)); + /* Writing zero expiration time should disarm it. */ + timerfd_settime (timerfd, TFD_TIMER_ABSTIME, &ispec, 0); + } +#endif /* HAVE_TIMERFD */ + alarm (0); + } } /* This is intended to use from automated tests. */ |