summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Ringwald <mringwal@inf.ethz.ch>2008-09-28 17:55:09 +0200
committerMatthias Ringwald <mringwal@inf.ethz.ch>2008-09-28 17:55:09 +0200
commit15b6ed2951acc37eb76037ebb786ab827a2c8031 (patch)
tree29bfdb9a6de551832a79a79d51315634521b157d /src
parent3afabe6fdbcdac1d26e2621845fadb29e106d87a (diff)
downloadxine-lib-15b6ed2951acc37eb76037ebb786ab827a2c8031.tar.gz
xine-lib-15b6ed2951acc37eb76037ebb786ab827a2c8031.tar.bz2
Fix xine_usec_sleep for mingw+msys
Bug was found and fixed by Carlo Bramini. select() does not work on mingw+msys causing xine_usec_sleep to sleep much longer than requested which completely broke audio playback
Diffstat (limited to 'src')
-rw-r--r--src/xine-utils/utils.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c
index 57a92623c..689b68502 100644
--- a/src/xine-utils/utils.c
+++ b/src/xine-utils/utils.c
@@ -456,23 +456,22 @@ char *xine_chomp(char *str) {
* a thread-safe usecond sleep
*/
void xine_usec_sleep(unsigned usec) {
-#if 0
-#if HAVE_NANOSLEEP
+#ifdef WIN32
+ /* select does not work on win32 */
+ Sleep(usec / 1000);
+#else
+# if 0
+# if HAVE_NANOSLEEP
/* nanosleep is prefered on solaris, because it's mt-safe */
struct timespec ts, remaining;
-
ts.tv_sec = usec / 1000000;
ts.tv_nsec = (usec % 1000000) * 1000;
while (nanosleep (&ts, &remaining) == -1 && errno == EINTR)
ts = remaining;
-#else
-# if WIN32
- Sleep(usec / 1000);
-# else
+# else
usleep(usec);
-# endif
-#endif
-#else
+# endif
+# else
if (usec < 10000) {
usec = 10000;
}
@@ -480,6 +479,7 @@ void xine_usec_sleep(unsigned usec) {
tm.tv_sec = usec / 1000000;
tm.tv_usec = usec % 1000000;
select(0, 0, 0, 0, &tm);
+# endif
#endif
}