summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/threads_posix.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/threads_posix.cpp b/src/threads_posix.cpp
index 3e8efd2..57f7b00 100644
--- a/src/threads_posix.cpp
+++ b/src/threads_posix.cpp
@@ -2,6 +2,8 @@
#include <unistd.h>
#include <pthread.h>
#include <sys/time.h>
+#include <sys/select.h>
+#include <sys/types.h>
#include "threads.h"
#include "utility.h"
@@ -81,8 +83,11 @@ namespace audiere {
int seconds = milliseconds / 1000;
int useconds = (milliseconds % 1000) * 1000;
- sleep(seconds);
- usleep(useconds);
+ struct timeval tv;
+
+ tv.tv_sec = seconds;
+ tv.tv_usec = useconds;
+ select(0, 0, 0, 0, &tv);
}