mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-15 19:09:58 +08:00
a8b08518c1
* 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.
19 lines
431 B
C
19 lines
431 B
C
/* 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;
|
|
}
|