aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2015-06-30 19:09:02 +0300
committerEli Zaretskii2015-06-30 19:09:02 +0300
commit3bea77f65504ee7c4364c300fd1f7d699e2866ac (patch)
tree2909bfde3fcd95c37b1b62632c8209d628e94310 /src
parent43593cb4173964a978a983e2eca4cbf86e01592a (diff)
downloademacs-3bea77f65504ee7c4364c300fd1f7d699e2866ac.tar.gz
emacs-3bea77f65504ee7c4364c300fd1f7d699e2866ac.zip
Make sure sleep-for always delays for as long as it's told
* src/dispnew.c (Fsleep_for): Call wait_reading_process_output in a loop, to ensure we always wait exactly the required amount of time. (Bug#15990)
Diffstat (limited to 'src')
-rw-r--r--src/dispnew.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index 1fc3cfeef44..7833fe3d01c 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -5679,8 +5679,16 @@ additional wait period, in milliseconds; this is for backwards compatibility.
5679 if (duration > 0) 5679 if (duration > 0)
5680 { 5680 {
5681 struct timespec t = dtotimespec (duration); 5681 struct timespec t = dtotimespec (duration);
5682 wait_reading_process_output (min (t.tv_sec, WAIT_READING_MAX), 5682 struct timespec tend = timespec_add (current_timespec (), t);
5683 t.tv_nsec, 0, 0, Qnil, NULL, 0); 5683
5684 /* wait_reading_process_output returns as soon as it detects
5685 output from any subprocess, so we wait in a loop until the
5686 time expires. */
5687 do {
5688 wait_reading_process_output (min (t.tv_sec, WAIT_READING_MAX),
5689 t.tv_nsec, 0, 0, Qnil, NULL, 0);
5690 t = timespec_sub (tend, current_timespec ());
5691 } while (timespec_sign (t) > 0);
5684 } 5692 }
5685 5693
5686 return Qnil; 5694 return Qnil;