changeset 3317:092399af4e5d

[project @ 1999-10-22 01:13:44 by jwe]
author jwe
date Fri, 22 Oct 1999 01:13:45 +0000
parents ce3372c4cf0d
children f38b5d63d02d
files src/ChangeLog src/cutils.c
diffstat 2 files changed, 18 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Oct 21 23:58:38 1999 +0000
+++ b/src/ChangeLog	Fri Oct 22 01:13:45 1999 +0000
@@ -1,5 +1,7 @@
 1999-10-21  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* cutils.c (do_octave_usleep): Handle useconds > 1e6.
+
 	* variables.h (is_valid_function): Provide default values for the
 	string argument.
 
--- a/src/cutils.c	Thu Oct 21 23:58:38 1999 +0000
+++ b/src/cutils.c	Fri Oct 22 01:13:45 1999 +0000
@@ -39,8 +39,8 @@
 #include <sys/poll.h>
 #endif
 
-void
-octave_usleep (unsigned int useconds)
+static void
+do_octave_usleep (unsigned int useconds)
 {
 #if defined (HAVE_USLEEP)
 
@@ -60,14 +60,24 @@
   struct pollfd pfd;
   int delay = useconds / 1000;
 
-  if (delay <= 0)
-    delay = 1;
-
-  poll (&fd, 0, delay);
+  if (delay > 0)
+    poll (&fd, 0, delay);
 
 #endif
 }
 
+void
+octave_usleep (unsigned int useconds)
+{
+  unsigned int sec = useconds / 1000000;
+  unsigned int usec = useconds % 1000000;
+
+  if (sec > 0)
+    sleep (sec);
+
+  do_usleep (usec);
+}
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***