changeset 24089:1909078be6c7

pause: don't interrupt sleep on harmless signals (bug #52084) * utils.cc (octave_sleep): Continue calling nanosleep with time remaining when it is interrupted by a signal.
author Mike Miller <mtmiller@octave.org>
date Thu, 21 Sep 2017 23:27:13 -0700
parents 0160a3199b2d
children 04e17bfe7a00
files libinterp/corefcn/utils.cc
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/utils.cc	Fri Sep 22 17:17:45 2017 -0400
+++ b/libinterp/corefcn/utils.cc	Thu Sep 21 23:27:13 2017 -0700
@@ -1362,10 +1362,14 @@
                 : static_cast<time_t> (seconds));
 
   struct timespec delay = { sec, static_cast<long> (fraction) };
-  struct timespec remaining;
-  octave_nanosleep_wrapper (&delay, &remaining);
+  int status;
 
-  octave_quit ();
+  do
+    {
+      status = octave_nanosleep_wrapper (&delay, &delay);
+      octave_quit ();
+    }
+  while (status == -1 && errno == EINTR);
 }
 
 DEFUN (isindex, args, ,