Usleep implementation based on select.

This commit is contained in:
Philip Homburg 2005-07-11 13:08:00 +00:00
parent b5809b6a81
commit 0cabfc76ee
2 changed files with 22 additions and 0 deletions

View file

@ -101,6 +101,7 @@ OBJECTS = \
$(LIBRARY)(priority.o) \
$(LIBRARY)(readlink.o) \
$(LIBRARY)(symlink.o) \
$(LIBRARY)(usleep.o) \
$(LIBRARY): $(OBJECTS)
aal cr $@ *.o
@ -388,3 +389,6 @@ $(LIBRARY)(lstat.o): lstat.c
$(LIBRARY)(symlink.o): symlink.c
$(CC1) symlink.c
$(LIBRARY)(usleep.o): usleep.c
$(CC1) usleep.c

18
lib/posix/usleep.c Normal file
View file

@ -0,0 +1,18 @@
/*
lib/posix/usleep.c
*/
#include <unistd.h>
#include <sys/select.h>
#include <sys/time.h>
int usleep(useconds_t useconds)
{
int r;
struct timeval tv;
tv.tv_sec= useconds/1000000;
tv.tv_usec= useconds % 1000000;
r= select(0, NULL, NULL, NULL, &tv);
return r;
}