diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-04-01 03:48:51 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-04-01 03:48:51 +0000 |
commit | 3ab984176452000cc845adfb4afc8808a404a3c6 (patch) | |
tree | e5445ca386114bae6100788b9ace544ae48409f9 /src/utils.c | |
parent | 917af619da81e88fe3b10b54171935e093fb8821 (diff) | |
download | mpd-3ab984176452000cc845adfb4afc8808a404a3c6.tar.gz mpd-3ab984176452000cc845adfb4afc8808a404a3c6.tar.xz mpd-3ab984176452000cc845adfb4afc8808a404a3c6.zip |
use our own portable version of usleep using select()
git-svn-id: https://svn.musicpd.org/mpd/trunk@578 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | src/utils.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c index 63c57de26..6e2d6e1e3 100644 --- a/src/utils.c +++ b/src/utils.c @@ -18,8 +18,13 @@ #include "utils.h" +#include <stdlib.h> #include <string.h> #include <ctype.h> +#include <sys/select.h> +#include <sys/time.h> +#include <sys/types.h> +#include <unistd.h> char * myFgets(char * buffer, int bufferSize, FILE * fp) { char * ret = fgets(buffer,bufferSize,fp); @@ -43,3 +48,12 @@ void stripReturnChar(char * string) { *string = ' '; } } + +void my_usleep(long usec) { + struct timeval tv; + + tv.tv_sec = 0; + tv.tv_usec = usec; + + select(0,NULL,NULL,NULL,&tv); +} |