Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2007-06-13 21:44:24 +0400
committerJeff Johnston <jjohnstn@redhat.com>2007-06-13 21:44:24 +0400
commita8b08518c115928e471b02cf200cf54b2462f048 (patch)
treeb5360122fa1113f8326bd330a8cb71e30b1d7016 /newlib/libc/machine/spu/usleep.c
parent8905d0dcfde388f376367767b0f450dbbeeef90c (diff)
2007-06-13 Patrick Mansfield <patmans@us.ibm.com>
* libc/include/sys/features.h: Define _POSIX_TIMERS for spu. * libc/include/sys/unistd.h: Change usleep prototype to Posix form and move outside of OS flag checks. * libc/machine/spu/Makefile.am: Add sleep and usleep. * libc/machine/spu/Makefile.in: Regenerate. * libc/machine/spu/sleep.c: Copy libc/posix/sleep.c. * libc/machine/spu/usleep.c: Copy libc/posix/usleep.c.
Diffstat (limited to 'newlib/libc/machine/spu/usleep.c')
-rw-r--r--newlib/libc/machine/spu/usleep.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/newlib/libc/machine/spu/usleep.c b/newlib/libc/machine/spu/usleep.c
new file mode 100644
index 000000000..c587f3141
--- /dev/null
+++ b/newlib/libc/machine/spu/usleep.c
@@ -0,0 +1,18 @@
+/* Copied from libc/posix/usleep.c, removed the check for HAVE_NANOSLEEP */
+
+/* Written 2002 by Jeff Johnston */
+
+#include <errno.h>
+#include <time.h>
+#include <unistd.h>
+
+int usleep(useconds_t useconds)
+{
+ struct timespec ts;
+
+ ts.tv_sec = (long int)useconds / 1000000;
+ ts.tv_nsec = ((long int)useconds % 1000000) * 1000;
+ if (!nanosleep(&ts,&ts)) return 0;
+ if (errno == EINTR) return ts.tv_sec;
+ return -1;
+}