summaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-04-01 03:48:51 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-04-01 03:48:51 +0000
commit3ab984176452000cc845adfb4afc8808a404a3c6 (patch)
treee5445ca386114bae6100788b9ace544ae48409f9 /src/utils.c
parent917af619da81e88fe3b10b54171935e093fb8821 (diff)
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 'src/utils.c')
-rw-r--r--src/utils.c14
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);
+}