aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2014-07-28 18:50:55 +0400
committerDmitry Antipov2014-07-28 18:50:55 +0400
commit2daa203c3eb983433b86b841bf31d3e91bb51ab4 (patch)
tree3e5c62bcf52d6ffea9254e6ce4f8a1393038d479 /src
parentda41ffdd089b529c3d5216412d95840e065c3fe3 (diff)
downloademacs-2daa203c3eb983433b86b841bf31d3e91bb51ab4.tar.gz
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')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/atimer.c23
-rw-r--r--src/process.c2
3 files changed, 32 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 57d49594d7a..0c79309609f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -35,6 +35,14 @@
35 Define as no-op. 35 Define as no-op.
36 (adjust_frame_size): Always declare prototype. 36 (adjust_frame_size): Always declare prototype.
37 37
38 Fix Gnus-related issues reported by David Kastrup <dak@gnu.org> in
39 <http://lists.gnu.org/archive/html/emacs-devel/2014-07/msg00370.html>.
40 * atimer.c (timerfd_callback): Always read expiration data.
41 Add comment.
42 (turn_on_atimers) [HAVE_TIMERFD]: Disarm timerfd timer.
43 * process.c (add_timer_wait_descriptor): Add timer descriptor
44 to input_wait_mask and non_process_wait_mask as well.
45
382014-07-28 Paul Eggert <eggert@cs.ucla.edu> 462014-07-28 Paul Eggert <eggert@cs.ucla.edu>
39 47
40 * frame.c (x_set_frame_parameters): Don't use uninitialized locals. 48 * frame.c (x_set_frame_parameters): Don't use uninitialized locals.
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)
410 410
411#ifdef HAVE_TIMERFD 411#ifdef HAVE_TIMERFD
412 412
413/* Called from wait_reading_process_output when FD, which
414 should be equal to TIMERFD, is available for reading. */
415
413void 416void
414timerfd_callback (int fd, void *arg) 417timerfd_callback (int fd, void *arg)
415{ 418{
419 char buf[8];
420 ptrdiff_t nbytes;
421
422 eassert (fd == timerfd);
423 nbytes = emacs_read (fd, buf, sizeof (buf));
424 /* Just discard an expiration count for now. */
425 eassert (nbytes == sizeof (buf));
416 do_pending_atimers (); 426 do_pending_atimers ();
417} 427}
418 428
@@ -442,7 +452,18 @@ turn_on_atimers (bool on)
442 if (on) 452 if (on)
443 set_alarm (); 453 set_alarm ();
444 else 454 else
445 alarm (0); 455 {
456#ifdef HAVE_TIMERFD
457 if (special_timer_available > 1)
458 {
459 struct itimerspec ispec;
460 memset (&ispec, 0, sizeof (ispec));
461 /* Writing zero expiration time should disarm it. */
462 timerfd_settime (timerfd, TFD_TIMER_ABSTIME, &ispec, 0);
463 }
464#endif /* HAVE_TIMERFD */
465 alarm (0);
466 }
446} 467}
447 468
448/* This is intended to use from automated tests. */ 469/* This is intended to use from automated tests. */
diff --git a/src/process.c b/src/process.c
index cfc1e189cab..f34be69864a 100644
--- a/src/process.c
+++ b/src/process.c
@@ -6835,7 +6835,9 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
6835void 6835void
6836add_timer_wait_descriptor (int fd) 6836add_timer_wait_descriptor (int fd)
6837{ 6837{
6838 FD_SET (fd, &input_wait_mask);
6838 FD_SET (fd, &non_keyboard_wait_mask); 6839 FD_SET (fd, &non_keyboard_wait_mask);
6840 FD_SET (fd, &non_process_wait_mask);
6839 fd_callback_info[fd].func = timerfd_callback; 6841 fd_callback_info[fd].func = timerfd_callback;
6840 fd_callback_info[fd].data = NULL; 6842 fd_callback_info[fd].data = NULL;
6841 fd_callback_info[fd].condition |= FOR_READ; 6843 fd_callback_info[fd].condition |= FOR_READ;